//const int K = 5005;
//int _(){
//    int n, k;
//    cin >> n >> k;
//    vi arr(n);
//    cin >> arr;
//    vector<bitset<K> > l(n+1),r(n+1);
//    l[0][0] = 1;
//    r[0][0] = 1;
//    rep(i,1,n)
//        l[i] = l[i-1] | (l[i-1] << arr[i-1]);
//    reverse(all(arr));
//    rep(i,1,n)
//        r[i] = r[i-1] | (r[i-1] << arr[i-1]);
//    reverse(all(arr));
//    int ans = 0;
//    rep(i,0,n-1){
//        bitset<K> tl = l[i], tr = r[n-i-1];
//        bool found = false;
//        int ri = 0;
//        for(int x = k-1; x >= 0; --x){
//            if(!tl[x])
//                continue;
//            while(x+ri < k){
//                if(tr[ri] && ri+x+arr[i] >= k)
//                    found = true;
//                ++ri;
//            }
//        }
//        if(found)
//            ++ans;
//    }
//    return n-ans;
//}
#include <bitset>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <utility>
#include <iostream>
#include <string>
#define REP_ANY(type,i,l,r) for(type i = l; i <= r; ++i)
#define REP_INT(i,l,r) for(int i = l; i <= r; ++i)
#define GET_REP_MACRO(_1,_2,_3,_4,NAME,...) NAME
#define rep(...) GET_REP_MACRO(__VA_ARGS__,REP_ANY,REP_INT)(__VA_ARGS__)
#define all(v) (v).begin(), (v).end()
#define T1 template<typename T> static
using namespace std;
typedef vector<int> vi;
template <typename F, typename S> static
ostream& operator<<(ostream& stream, const pair<F, S>& t){
    return stream << t.first << ' ' << t.second;
}
template <typename F, typename S> static
istream& operator>>(istream& stream, pair<F, S>& t){
    return stream >> t.first >> t.second;
}
T1 ostream& operator<<(ostream& stream, const vector<T>& t);
T1 istream& read(T, T, istream& = cin);
T1 istream& operator>>(istream& stream, vector<T>& t){
    return read(all(t), stream);
}
T1 istream& read(T b, T e, istream& stream){
    for(T it = b; it != e; ++it)
        stream >> *it;
    return stream;
}
T1 void print(T x, string end = "\n"){
    cout << x << end;
}
T1 ostream& print(T b, T e, string sep = " ", ostream& stream = cout){
    for(T it = b; it != e; ++it){
        stream << *it;
        if(it + 1 != e)
            stream << sep;
    }
    return stream;
}
T1 ostream& operator<<(ostream& stream, const vector<T>& t){
    return print(all(t), " ", stream);
}
T1 void print(vector<T> arr, string sep = " "){
    if(arr.empty()){
        return;
    }
    print(arr.begin(), arr.end(), sep);
    cout << '\n';
}
const int K = 5005;
int _(){
    int n, k;
    cin >> n >> k;
    vi arr(n);
    cin >> arr;
    vector<bitset<K> > l(n+1),r(n+1);
    l[0][0] = 1;
    r[0][0] = 1;
    rep(i,1,n)
        l[i] = l[i-1] | (l[i-1] << arr[i-1]);
    reverse(all(arr));
    rep(i,1,n)
        r[i] = r[i-1] | (r[i-1] << arr[i-1]);
    reverse(all(arr));
    int ans = 0;
    rep(i,0,n-1){
        bitset<K> tl = l[i], tr = r[n-i-1];
        bool found = false;
        int ri = 0;
        for(int x = k-1; x >= 0; --x){
            if(!tl[x])
                continue;
            while(x+ri < k){
                if(tr[ri] && ri+x+arr[i] >= k)
                    found = true;
                ++ri;
            }
        }
        if(found)
            ++ans;
    }
    return n-ans;
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(15);
        cout << _() << '\n';
}


Measured memory_bytes: 6400