#include <bits/stdc++.h>
using namespace std;
int n, m, f[200500];
int main() {
  scanf("%d%d", &n, &m);
  memset(f, 63, sizeof(f));
  f[0] = 0;
  int x;
  for (int i = 1; i <= n; ++i) {
    scanf("%d", &x);
    for (int j = m; j; --j) f[j] = min(f[j], f[max(0, j - x)] + 1);
  }
  printf("%d\n", f[m]);
}
