Problem n: CCC '13 J4 - Time on task

Problem n: CCC '13 J4 - Time on task

Time Limit: 1 Sec  Memory Limit: 128 MB
Submit: 12  Solved: 9
[Submit] [Status] [Web Board] [Creator:]

Description

You have been asked by a parental unit to do your chores.
Each chore takes a certain amount of time, but you may not have enough time to do all of your chores, 
since you can only complete one chore at a time. You can do the chores in any order that you wish.
What is the largest amount of chores you can complete in the given amount of time?

Input

The first line of input consists of an integer T (0≤T≤100000), 
which is the total number of minutes you have available to complete your chores.

The second line of input consists of an integer C (0≤C≤100), which is the total number of chores that you may choose from. 
The next C lines contain the (positive integer) number of minutes required to do each of these chores. 
You can assume that each chore will take at most 100000 minutes.

Output

The output will be the maximum number of chores that can be completed in time T.

Sample Input Copy

6
3
3
6
3

Sample Output Copy

2