```
#define _CRT_SECURE_NO_DEPRECATE
#include<sstream>
#include<iostream>
#include<numeric>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<memory>
#include<string>
#include<vector>
#include<cctype>
#include<list>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<complex>
#include<set>
#include<algorithm>
using namespace std;
typedef unsigned long long ui64;
typedef long long i64;
typedef vector<int> VI;
typedef vector<bool> VB;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int,int> PII;
typedef map<string,int> MSI;
typedef set<int> SI;
typedef set<string> SS;
typedef complex<double> CD;
typedef vector< CD > VCD;
typedef map<int,int> MII;
typedef pair<double,double> PDD;
#define PB push_back
#define MP make_pair
#define X first
#define Y second
#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define RFOR(i, a, b) for(int i = (a) - 1; i >= (b); --i)
#define CLEAR(a, b) memset(a, b, sizeof(a))
#define SZ(a) int((a).size())
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define INF (2000000000)
#ifdef _DEBUG
#define eprintf(...) fprintf (stderr, __VA_ARGS__)
#else
#define eprintf(...) assert (true)
#endif
const double PI = acos(-1.0);
int main() {
int n,k;
scanf("%d%d",&n,&k);
VI a(n);
FOR(i,0,n) {
scanf("%d",&a[i]);
}
sort(ALL(a));
FOR(i,0,n) {
k -= a[i];
if(k<0) {
cout << i << endl;
return 0;
}
}
cout << n << endl;
return 0;
}
```

**Problem Description**

Mark and Jane are very happy after having their first kid. Their son is very fond of toys, so Mark wants to buy some. There are N different toys lying in front of him, tagged with their prices, but he has only $K. He wants to maximize the number of toys he buys with this money.

Now, you are Mark’s best friend and have to help him buy as many toys as possible.

Input Format

The first line contains two integers, N and K, followed by a line containing N space separated integers indicating the products’ prices.

Constraints

1 <= N <= 10^5

1 <= K <= 10^9

1 <= price of any toy<= 10^9

A toy can’t be bought multiple times.

Output Format

An integer that denotes maximum number of toys Mark can buy for his son.**Test Case 1****Input (stdin)**7 50

1 12 5 111 200 1000 10

**Expected Output**4**Test Case 2****Input (stdin)**5 100

10 120 5 20 200

**Expected Output**3