import std.algorithm;
import std.array;
import std.ascii;
import std.bigint;
import std.complex;
import std.container;
import std.conv;
import std.functional;
import std.math;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

auto readInts() {
	return array(map!(to!int)(readln().strip().split()));
}
auto readInt() {
	return readInts()[0];
}
auto readLongs() {
	return array(map!(to!long)(readln().strip().split()));
}
auto readLong() {
	return readLongs()[0];
}

void readlnTo(T...)(ref T t) {
    auto s = readln().split();
    assert(s.length == t.length);
    foreach(ref ti; t) {
        ti = s[0].to!(typeof(ti));
        s = s[1..$];
    }
}

class UnionFindTree {
public:
    this(size_t n) {
        parent = iota(n).array();
        rank = new size_t[](n);
    }
    size_t find(size_t n) {
        if(n == parent[n]) {
            return n;
        } else {
            parent[n] = find(parent[n]);
            return parent[n];
        }
    }
    void unite(size_t n, size_t m) {
        auto p1 = find(n);
        auto p2 = find(m);
        if(n == m) {
            return;
        }
        if(rank[p1] < rank[p2]) {
            swap(p1, p2);
        }
        if(rank[p1] == rank[p2]) {
            ++rank[p1];
        }
        parent[p2] = p1;
    }
private:
    size_t[] parent;
    size_t[] rank;
}
unittest {
    auto uft = new UnionFindTree(10);
    foreach(i; iota(10)) {
        assert(uft.find(i) == i);
    }
    foreach(i; iota(10).filter!(a => a%3 == 0).drop(1)) {
        uft.unite(i, i-3);
    }
    foreach(i; iota(10).filter!(a => a%3 == 0)) {
        assert(uft.find(0) == uft.find(i));
    }
    foreach(i; iota(10).filter!(a => a%3 != 0)) {
        assert(uft.find(0) != uft.find(i));
    }
}

const real eps = 1e-10;

const long p = 1_000_000_000 + 7;

//aとbから一つづつ取り出したものの和で、l以上u未満を作れるか調べる
bool test(bool[] a, bool[] b, long l, long u) {
    auto A = iota(a.length).filter!(x => a[x]).map!(to!long).array.assumeSorted();
    auto B = iota(b.length).filter!(x => b[x]).map!(to!long).array.assumeSorted();
    if(A.length > B.length) {
        swap(A, B);
    }
    foreach(ai; A) {
        auto t = B.lowerBound(u-ai).trisect(l-ai);
        if(!t[1].empty() || !t[2].empty()) {
            return true;
        }
    }
    return false;
}

void main(){
    long n, k;
    readlnTo(n, k);
    auto a = readLongs();
    
    auto dp1 = new bool[][](n+1, k);
    dp1[0][0] = true;
    foreach(i; iota(n)) {
        foreach(j; iota(k)) {
            if(!dp1[i][j]) { 
                continue;
            }
            dp1[i+1][j] = true;
            if(j + a[i] < k) {
                dp1[i+1][j+a[i]] = true;
            }
        }
    }

    auto dp2 = new bool[][](n+1, k);
    dp2[0][0] = true;
    foreach(i; iota(n)) {
        foreach(j; iota(k)) {
            if(!dp2[i][j]) {
                continue;
            }
            dp2[i+1][j] = true;
            if(j + a[n-i-1] < k) {
                dp2[i+1][j+a[n-i-1]] = true;
            }
        }
    }
    long ans;
    foreach(i; iota(n)) {
        if(!test(dp1[i], dp2[n-1-i], k-a[i], k)) {
            ++ans;
        }
    }
    writeln(ans);
}



Measured memory_bytes: 93948