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

template<class T> void fzt(vector<T>& a) {
  int n = a.size();
  assert(__builtin_popcount(n) == 1);
  for (int i = 0; 1 << i < n; ++i) {
    for (int S = 0; S < n; ++S) if (~S & 1 << i) {
      a[S | 1 << i] += a[S];
    }
  }
}

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int n, k;
  cin >> n >> k;
  vector<int> a(n);
  for (auto&& e : a) {
    cin >> e;
  }
  vector<int> f(1 << n);
  for (int s = 0; s < 1 << n; ++s) {
    int sum = 0;
    for (int i = 0; i < n; ++i) {
      if (s >> i & 1) {
        sum += a[i];
      }
    }
    f[s] = sum == k;
  }
  fzt(f);
  int res = 0;
  for (int s = 0; s < 1 << n; ++s) {
    if (f[s] == 0) {
      res = max(res, __builtin_popcount(s));
    }
  }
  cout << n - res << '\n';
}

