#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, x, res = 0;
  cin >> N >> x;
  int a[110];
  for (int i = 0; i < N; ++i) cin >> a[i];
  sort(a, a + N);
  int i = 0;
  if (!(x < a[0])) {
    while (x > 0) {
      if (x >= a[i]) {
        x -= a[i];
        ++res;
        ++i;
      } else {
        i = 0;
      }
      if (i == N) i = 0;
    }
  }
  cout << res << endl;
  return 0;
}
