Masala #REHXNNXLWJ
Scrooge McDaMia
All of you know Scrooge McDuck, Shohjahon recently made friends with him and he became greedy too. He decided to buy \(n\) rubber ducks. Each rubber duck has its own price. Shohjahon initially had \(m\) coins. He wants to buy as many ducks as possible, what is the maximum number of ducks he can buy?

First line contains a number \(n\) (1 ≤ \(n\) ≤ \(10^5\)).
Second line contains a nubmer \(m\) (1 ≤ \(m\) ≤ \(10^9\)).
Next \(n\) lines each contain number \(a_i\) (1 ≤ \(a_i\) ≤ \(10^9\)), the price of the \(i\)th duck.
Print the maximum number of rubber ducks Shohjahon can buy.
# | input.txt | output.txt |
---|---|---|
1 |
4 5 2 1 3 4 |
2 |
\(a_i\) means \(i\)th element of an array \(a\).
For example in array \([1, 2, 3]\), \(a_1\) is 2 (0 based indexing).