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].to!long;
    auto AA = readln.split.map!(to!long).array;
    AA.sort();
    if (AA.sum < K) {
        N.writeln;
        return;
    }

    auto A = AA.assumeSorted.lowerBound(K).array;
    N = A.length.to!int;
    if (N <= 1) {
        0.writeln;
        return;
    }

    auto dp1 = new bool[][](N, K);
    auto dp2 = new bool[][](N, K);

    dp1[0][A[0]] = true;
    dp1[0][0] = true;
    foreach (i; 1..N) {
        foreach (j; 0..K) {
            if (dp1[i-1][j] && A[i]+j < K) {
                dp1[i][A[i]+j] = true;
            }
            if (dp1[i-1][j]) dp1[i][j] = true;
        }
    }

    dp2[N-1][A[N-1]] = true;
    dp2[N-1][0] = true;
    foreach (i; iota(N-2, -1, -1)) {
        foreach (j; 0..K) {
            if (dp2[i+1][j] && A[i]+j < K) {
                dp2[i][A[i]+j] = true;
            }
            if (dp2[i+1][j]) dp2[i][j] = true;
        }
    }


    int ans = 0;
    foreach (i; 0..N) {
        bool required = false;
        if (i == 0) {
            foreach (j; K-A[i]..K) {
                if (dp2[i+1][j]) {
                    required = true;
                    break;
                }
            }
            if (!required) ans += 1;
            continue;
        }
        if (i == N - 1) {
            foreach (j; K-A[i]..K) {
                if (dp1[i-1][j]) {
                    required = true;
                    break;
                }
            }
            if (!required) ans += 1;
            continue;
        }

        auto st = new SegmentTree(K.to!int);
        foreach (j; 0..K) st.add(j.to!int, dp2[i+1][j]);
        foreach (j; 0..K) {
            if (dp1[i-1][j]) {
                if (st.sum(max(0, K-A[i]-j).to!int, min(K-1, K-j-1).to!int) > 0) {
                    required = true;
                    break;
                }
            }
        }

        if (!required) ans += 1;

    }

    ans.writeln;
}


class SegmentTree {
    int[] table;
    int size;

    this(int n) {
        assert(bsr(n) < 29);
        size = 1 << (bsr(n) + 2);
        table = new int[](size);
    }

    void add(int pos, int num) {
        return add(pos, num, 0, 0, size/2-1);
    }

    void add(int pos, int num, int i, int left, int right) {
        table[i] += num;
        if (left == right)
            return;
        auto mid = (left + right) / 2;
        if (pos <= mid)
            add(pos, num, i*2+1, left, mid);
        else
            add(pos, num, i*2+2, mid+1, right);
    }

    int sum(int pl, int pr) {
        return sum(pl, pr, 0, 0, size/2-1);
    }

    int sum(int pl, int pr, int i, int left, int right) {
        if (pl > right || pr < left)
            return 0;
        else if (pl <= left && right <= pr)
            return table[i];
        else
            return
                sum(pl, pr, i*2+1, left, (left+right)/2) +
                sum(pl, pr, i*2+2, (left+right)/2+1, right);
    }
}
