#include <bits/stdc++.h>
int f(int x, int* a, int N) {
  for (int i = 0; i < N; i++)
    if (x == a[i]) return 1;
  return 0;
}
int main(void) {
  int i, j, N, x, a[100], m, s = 0;
  scanf("%d%d", &N, &x);
  for (i = 0; i < N; i++) scanf("%d", &a[i]);
  i = -1;
  while (1) {
    for (m = 0; !a[m]; m++)
      ;
    for (j = m + 1; j < N; j++)
      if (a[j] < a[m] && a[j] > 0) m = j;
    if (x < a[m]) break;
    x -= a[m];
    if (x >= a[m])
      s++;
    else if (f(x + a[m], a, N)) {
      s++;
      break;
    }
    a[m] = 0;
  }
  printf("%d\n", s);
}
