joj2154

2154: Hungry Rabbits

Result TIME Limit MEMORY Limit Run Times AC Times JUDGE
3s 8192K 1141 400 Standard
A group of hungry rabbits had got a basket of carrots, but these carrots isn't enough for all the rabbits to stay alive. So they had a meeting to solve the problem. They determined to drive off some rabbits,then the rest of them could have enough carrots. The number of carrots each rabbit required is given as a nonegetive interger v i, and there's T carrots in the basket. The chairman of rabbit association is a big beautiful and strong rabbit, he was very pity for doing this thing, and he wanted to know the least number of rabbits they would drive off to make the rest of the rabbits stay alive.

Input

There's more than one test case.In each case, there're two positive integers T and N. T stands for the number of carrots in the basket and N(1<=N<=1000) stands for the total number of the rabbits. Then following N lines each contains a nonegetive interger v i. These N intergers stand for the carrots each rabbit needed.

Output

For each test case ,output the least number of rabbits they would drive off!

Sample Input

30 5
12
14
23
4
10

Sample Output

2

Problem Source: sea

This problem is used for contest: 23 

Submit / Problem List / Status / Discuss


你可能感兴趣的:(joj2154)