2015
05-23

Water World II

The well known PC game engineer Kevin Flynn designed a new game:Water World II.Player can enters the Virtual Water World and build the world through this game.
Jack is the Administrator of Virtual World.He is responsible for water conservation project.Now Kevin gives him a big mission:building a reservoir made with thousands of mountain.

Every mountain’s width is 1 unit and the hight is Hi .Mountain numbered from left to right.The valley between two mountains can hold water.
Jack can move the leftmost mountain to the rightmost for several times(include zero).
In order to complete the project,Kevin provide k unit building materials for Jack .Jack can add them to some mountain’s top(In order to maintain the stability of reservoir,The maximum height can not be changed).

The input consists of several test cases(about 20).
For each case,there are two integer n,k in first line.(0<n<=10000,0<k<=10).
Then follow one line there are n integers indicate that the i-th mountain’s height is Hi.the mountain start from left to right.(0<Hi<10000000)

The input consists of several test cases(about 20).
For each case,there are two integer n,k in first line.(0<n<=10000,0<k<=10).
Then follow one line there are n integers indicate that the i-th mountain’s height is Hi.the mountain start from left to right.(0<Hi<10000000)

3 0
2 3 1
7 2
1 3 2 5 2 3 4

1
11
Hint
Case 1:

Case 2:



1. 身為中國人..你們都忘記我們文化有五千年之久(3000BC+西元2012)..所以西方遠古人難道都是食古不化嗎?別想到到外星人.人類是有腦子的!

2. 身為中國人..你們都忘記我們文化有五千年之久(3000BC+西元2012)..所以西方遠古人難道都是食古不化嗎?別想到到外星人.人類是有腦子的!

3. 身為中國人..你們都忘記我們文化有五千年之久(3000BC+西元2012)..所以西方遠古人難道都是食古不化嗎?別想到到外星人.人類是有腦子的!

4. 身為中國人..你們都忘記我們文化有五千年之久(3000BC+西元2012)..所以西方遠古人難道都是食古不化嗎?別想到到外星人.人類是有腦子的!

5. 身為中國人..你們都忘記我們文化有五千年之久(3000BC+西元2012)..所以西方遠古人難道都是食古不化嗎?別想到到外星人.人類是有腦子的!

6. 身為中國人..你們都忘記我們文化有五千年之久(3000BC+西元2012)..所以西方遠古人難道都是食古不化嗎?別想到到外星人.人類是有腦子的!

7. 身為中國人..你們都忘記我們文化有五千年之久(3000BC+西元2012)..所以西方遠古人難道都是食古不化嗎?別想到到外星人.人類是有腦子的!

8. 身為中國人..你們都忘記我們文化有五千年之久(3000BC+西元2012)..所以西方遠古人難道都是食古不化嗎?別想到到外星人.人類是有腦子的!

9. 身為中國人..你們都忘記我們文化有五千年之久(3000BC+西元2012)..所以西方遠古人難道都是食古不化嗎?別想到到外星人.人類是有腦子的!