发布时间: 2018年12月8日 20:11   最后更新: 2018年12月8日 20:14   时间限制: 1000ms   内存限制: 512M

Rurutie is now shopping in a bookstore.

There are $n$ books lining up on a bookshelf with ids of $1,2,3,\cdots,n$ from left to right, where the price of the $i$th book is $a_i$, respectively.

Rurutie has $w$ money and wants to spend the money as much as possible due to the fact that more expensive, most interesting.

Rurutie also wants to spend time as little as possible when the condition above has been met.

Getting the books will take Rurutie $r-l$ seconds because she needs to move from the index $l$ to $r$, where $l$ and $r$ are the smallest and the greatest id of the books she'll buy, respectively.

How long will she spend?

Input starts with two integers $n,w(1 \le n,w \le 5000)$.

The second line contains $n$ integers, where the $i$th integer representing $a_i(1 \le a_i \le 5000)$.

Output two integers where the first representing the money Rurutie will spend and the second representing the time she will spend.

Specially, if Rurutie can't buy any books, the second integer should be 0.

4 7
2 1 5 4 
7 2

Rurutie can buy the 1st and the 3rd book with 7 money and 2 seconds.

2018 fdupc

2018 FDUPC 程序设计校赛现场赛(网络同步赛)