import std.stdio, std.array, std.string, std.conv, std.algorithm;
import std.typecons, std.range, std.random, std.math, std.container;
import std.numeric, std.bigint, core.bitop, core.stdc.stdio;

void main() {
    auto s = readln.split.map!(to!int);
    auto N = s[0];
    auto K = s[1];
    auto A = readln.split.map!(to!long).array;
    A.sort();

    if (A.sum < K) {
        N.writeln;
        return;
    }


    int ans = 0;
    int hi = N-1;
    int lo = -1;
    while (hi -lo > 1) {
        int mid = (hi + lo) / 2;

        if (A[mid] >= K) {
            hi = mid;
            continue;
        }

        auto dp = new bool[][](N+1, K);
        dp[0][0] = true;
        bool ok = false;

        foreach (j; 0..N) {
            if (A[j] >= K) break;
            if (K-A[mid] <= A[j] && A[j] < K) {
                ok = true;
                break;
            }
            if (j == mid) continue;
            foreach (k; 0..K) {
                if (k + A[j] >= K) break;
                if (dp[j][k]) {
                    if (K-A[mid] <= k+A[j] && k+A[j] < K) {
                        ok = true;
                        break;
                    }
                    dp[j+1][A[j]+k] = true;
                }
            }
            if (ok) break;
            dp[j+1][A[j]] = true;
        }

        if (ok) hi = mid;
        else lo = mid;

    }

    (lo+1).writeln;
}
