#include <bits/stdc++.h>
using namespace std;
const int N = 105;
const int M = 1e8;
int f[M];
int n;
long long m;
long long a[N];
int main() {
  scanf("%d%lld", &n, &m);
  for (int i = 1; i <= n; i++) scanf("%lld", &a[i]);
  memset(f, 0, sizeof(f));
  for (int i = 1; i <= n; i++) {
    for (int j = m; j >= 1; j--) {
      f[j] = max(f[i], f[j - a[i]] + 1);
    }
  }
  printf("%d\n", f[m]);
  return 0;
}
