| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 0.5 초 | 512 MB | 239 | 153 | 130 | 65.657% |
You are the manager of a restaurant. You prepare N lunch boxes and hope to distribute them to some schools. Suppose there are m schools and assume the ith school asks for ki lunch boxes.
You aim to distribute the lunch boxes to as many schools as possible. Moreover, you have a rule. For the ith school, you give either zero or ki lunch boxes. Can you make a program that help you to find the maximum number of schools that can receive lunch boxes?
Your program must read from standard input. The first line contains 2 integers, N and m. Then, it follows by m lines. The ith line contains an integer ki.
Your program must output one line with a single integer to the standard output, which is the maximum number of schools.
10 4 3 9 4 2
3