~/algor $ cat problems/ochkoz-eng-kop-xarid
Maximum purchases
Easy
1000 ms
128 MB
22%
A shop has $n$ different items, the price of the $i$-th item is $p_{i}$ soums; each item can be bought at most once. The customer has $B$ soums. What is the largest number of items they can buy?
Input
The first line contains two integers: $n$ and $B$. The second line contains $n$ space-separated positive integers $p_{i}$.
Output
One integer — the largest number of items that can be bought.
Note
$1 \le n \le 10^{5}$
$1 \le p_{i} \le 10^{9}$
$0 \le B \le 10^{14}$
Examples
Input #1
5 20 8 3 12 5 7
Output #1
3
Input #2
3 2 5 3 4
Output #2
0