#!/bin/bash
cat <<'EOF' > Main.cpp
#include <cstdio>
#include <vector>
#include <bitset>
#define repeat(i,n) for (int i = 0; (i) < int(n); ++(i))
using namespace std;
template <class T> inline void setmin(T & a, T const & b) { a = min(a, b); }
constexpr int k_max = 5000;
int main() {
    int n, k; scanf("%d%d", &n, &k);
    vector<int> a(n);
    repeat (i,n) {
        scanf("%d", &a[i]);
        setmin(a[i], k);
    }
    int unnecessary = 0;
    auto mask_base = ~ (((~ bitset<k_max>()) >> k) << k);
    repeat (i,n) {
        if (a[i] == k) continue;
        auto mask = ((mask_base >> (k - a[i])) << (k - a[i]));
        bitset<k_max> dp = {};
        dp[0] = true;
        repeat (j,n) if (j != i) {
            dp |= dp << a[j];
            if (j % 256 == 0 and (dp & mask).any()) break;
        }
        if ((dp & mask).none()) {
            unnecessary += 1;
        }
    }
    printf("%d\n", unnecessary);
    return 0;
}
EOF
clang++ -std=c++11 -O3 -mtune=native -march=native Main.cpp -o Main
exec ./Main
