The package for this problem was not updated by the problem writer or Codeforces administration after we've upgraded the judging servers. To adjust the time limit constraint, a solution execution time will be multiplied by 2. For example, if your solution works for 400 ms on judging servers, then the value 800 ms will be displayed and used to determine the verdict.

Codeforces Beta Round 35 (Div. 2) |
---|

Finished |

Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests.
If you've seen these problems, a virtual contest is not for you - solve these problems in the archive.
If you just want to solve some problem from a contest, a virtual contest is not for you - solve this problem in the archive.
Never use someone else's code, read the tutorials or communicate with other person during a virtual contest.

dp

greedy

*1700

No tag edit access

The problem statement has recently been changed. View the changes.

×
D. Animals

time limit per test

2 secondsmemory limit per test

64 megabytesinput

input.txtoutput

output.txtOnce upon a time DravDe, an outstanding person famous for his professional achievements (as you must remember, he works in a warehouse storing Ogudar-Olok, a magical but non-alcoholic drink) came home after a hard day. That day he had to drink 9875 boxes of the drink and, having come home, he went to bed at once.

DravDe dreamt about managing a successful farm. He dreamt that every day one animal came to him and asked him to let it settle there. However, DravDe, being unimaginably kind, could send the animal away and it went, rejected. There were exactly *n* days in DravDe’s dream and the animal that came on the *i*-th day, ate exactly *c*_{i} tons of food daily starting from day *i*. But if one day the animal could not get the food it needed, it got really sad. At the very beginning of the dream there were exactly *X* tons of food on the farm.

DravDe woke up terrified...

When he retold the dream to you, he couldn’t remember how many animals were on the farm by the end of the *n*-th day any more, but he did remember that nobody got sad (as it was a happy farm) and that there was the maximum possible amount of the animals. That’s the number he wants you to find out.

It should be noticed that the animals arrived in the morning and DravDe only started to feed them in the afternoon, so that if an animal willing to join them is rejected, it can’t eat any farm food. But if the animal does join the farm, it eats daily from that day to the *n*-th.

Input

The first input line contains integers *n* and *X* (1 ≤ *n* ≤ 100, 1 ≤ *X* ≤ 10^{4}) — amount of days in DravDe’s dream and the total amount of food (in tons) that was there initially. The second line contains integers *c*_{i} (1 ≤ *c*_{i} ≤ 300). Numbers in the second line are divided by a space.

Output

Output the only number — the maximum possible amount of animals on the farm by the end of the *n*-th day given that the food was enough for everybody.

Examples

Input

3 4

1 1 1

Output

2

Input

3 6

1 1 1

Output

3

Note

Note to the first example: DravDe leaves the second and the third animal on the farm. The second animal will eat one ton of food on the second day and one ton on the third day. The third animal will eat one ton of food on the third day.

Codeforces (c) Copyright 2010-2024 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: Feb/28/2024 03:12:59 (h2).

Desktop version, switch to mobile version.

Supported by

User lists

Name |
---|