#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int N, K, a[5000];

bool C(int idx) {
    vector<vector<bool> > dp(N+1, vector<bool>(K+1, false));
    dp[0][0] = true;
    for(int i=0; i<N; i++) {
        for(int j=0; j<=K; j++) {
            if(dp[i][j]) {
                dp[i+1][j] = true;
                if(i != idx && j + a[i] <= K) dp[i+1][j+a[i]] = true;
            }
        }
    }
    int j = K - a[idx];
    if(j < 0) j = 0;
    for(; j<K; j++) {
        if(dp[N][j]) return true;
    }
    return false;
}

int main() {
    cin >> N >> K;
    for(int i=0; i<N; i++) cin >> a[i];
    sort(a, a+N, greater<int>());
    int l = 0, h = N + 1;
    while(h - l > 1) {
        int m = (l + h) / 2;
        if(C(m-1)) l = m;
        else h = m;
    }
    cout << N - l << endl;
    return 0;
}
