#GD0000004. Luộc trứng (Boiled Eggs)
Luộc trứng (Boiled Eggs)
Boiled Eggs
Source: UVa
Version: Phuoc Hung OJ Extended
Problem Statement
There are eggs with weights . At most eggs may be chosen and their total weight must not exceed . Find the maximum possible number of chosen eggs.
Input
The first line contains . The second line contains weights .
Output
Print the maximum number of eggs that can be chosen.
Subtasks
General constraints:
-
.
-
.
-
Subtask 1 (20 points):
-
Subtask 2 (30 points):
-
Subtask 3 (50 points): No additional constraints.
Examples
Input
3 2 10
1 2 3
Output
2
Explanation
The eggs of weights and can be selected. The count limit prevents selecting a third egg.