#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main() {
    int n, k;
    cin >> n >> k;
    vector<int> a(n);
    for (int i = 0; i < n; i++)cin >> a[i];

    int ret = 0;
    vector<bool> dp(1 << n);
    for (int bit = 0; bit < 1 << n; bit++) {
        int nowCount = 0, nowSum = 0;
        bool canMake = false;
        for (int i = 0; i < n; i++) {
            if (bit & (1 << i)) {
                nowCount++, nowSum += a[i];
                if (dp[bit ^ (1 << i)])canMake = true;
            }
        }
        if (canMake || nowSum == k) dp[bit] = true;
        else ret = max(ret, nowCount);
    }

    cout << n - ret << endl;
    return 0;
}
