#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <numeric>
#include <utility>
#include <tuple>

#define REP(i, a, b) for (int i = int(a); i < int(b); i++)
using namespace std;
using ll = long long int;
using P = pair<ll, ll>;

// clang-format off
#ifdef _DEBUG_
#define dump(...) do{ cerr << __LINE__ << ":\t" << #__VA_ARGS__ << " = "; PPPPP(__VA_ARGS__); cerr << endl; } while(false)
template<typename T> void PPPPP(T t) { cerr << t; }
template<typename T, typename... S> void PPPPP(T t, S... s) { cerr << t << ", "; PPPPP(s...); }
#else
#define dump(...) do{ } while(false)
#endif
template<typename T> vector<T> make_v(size_t a, T b) { return vector<T>(a, b); }
template<typename... Ts> auto make_v(size_t a, Ts... ts) { return vector<decltype(make_v(ts...))>(a, make_v(ts...)); }
template<typename T> bool chmin(T &a, T b) { if (a > b) {a = b; return true; } return false; }
template<typename T> bool chmax(T &a, T b) { if (a < b) {a = b; return true; } return false; }
template<typename T> void print(T a) { cout << a << endl; }
template<typename T, typename... Ts> void print(T a, Ts... ts) { cout << a << ' '; print(ts...); }
template<typename T> istream &operator,(istream &in, T &t) { return in >> t; }
// clang-format on

#include <array>
template<size_t N>
class INDEX {
    array<size_t, N> arr;

public:
    template<typename... T>
    INDEX(T... _arr)
        : arr({{static_cast<size_t>(_arr)...}}) {}
    template<typename... T>
    size_t operator()(T... _arr) {
        size_t position[] = {static_cast<size_t>(_arr)...};
        //static_assert(N == size(position));
        size_t res = 0, width = 1;
        for (int i = N - 1; i >= 0; i--) {
            res += width * position[i];
            width *= arr[i];
        }
        return res;
    }
};
template<typename... T>
auto Index(T... args) {
    //unsigned int arr[] = {static_cast<unsigned int>(args)...};
    constexpr size_t N = 3;
    return INDEX<N>(args...);
}
template<typename T>
auto make_v_flat(T init, int a, int b, int c) {
    return vector<T>((a * b * c), init);
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n, k;
    cin, n, k;
    vector<int> a(n);
    REP(i, 0, n) {
        cin, a[i];
    }

    auto dp = make_v_flat(false, 2, n + 1, k + 1);
    auto index = Index(2, n + 1, k + 1);
    dp[index(0, 0, 0)] = dp[index(1, 0, 0)] = true;

    REP(t, 0, 2) {
        REP(i, 0, n) {
            REP(j, 0, k + 1) {
                if (dp[index(t, i, j)]) {
                    dp[index(t, i + 1, j)] = true;
                    if (j + a[i] <= k) {
                        dp[index(t, i + 1, j + a[i])] = true;
                    }
                }
            }
        }
        reverse(a.begin(), a.end());
    }

    int ans = 0;
    REP(i, 0, n) {
        if (a[i] >= k) continue;
        int target = n - i - 1;
        vector<int> sum(k + 2, 0);
        REP(j, 0, k + 1) {
            sum[j + 1] = sum[j] + dp[index(1, target, j)];
        }
        bool add = true;
        REP(j, 0, k + 1) {
            if (dp[index(0, i, j)]) {
                int l = max(0, k - a[i] - j), r = k - j;
                if (sum[r] > sum[l]) {
                    add = false;
                }
            }
        }
        dump(i, a[i], add);
        ans += add;
    }

    print(ans);

    return 0;
}


Measured memory_bytes: 6400