#include <iostream>
#include <algorithm>
using namespace std;
#include <bits/stdc++.h>

int main() {
  int N, x, y. ans;
  y = 0;
  cin >> N >> x;
  vector<int> kids(110);
  for(int i = 0; i < N; i++){
   cin >> kids.at(i); 
  }
  sort(kids.begin(),kids.end());
  int i = 0;
  while(y < x){
    y += kids.at(i);
    i++;
      ans++;
  }
  cout << ans - 1 << endl;
  
}