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

int main() {
  int N, x;
  string a[110];
  cin >> N >> x;
  for (int i = 0; i < N; i++) {
  	cin >> a[i];
  }
  
  sort(s, s + N);
  int counter = 0;
  
  for (int i = 0; x < 0; i++) {
    if (x => a[i]) {
    x -= a[i];
    counter++;
    } 
  }
  cout << counter << endl;
}