/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author Majk
 */

#include <vector>
#include <iostream>
#include <unordered_map>
#include <map>
#include <iomanip>
#include <set>
#include <functional>
#include <fstream>
#include <algorithm>
#include <cassert>
#include <cmath>
#include <string>
#include <sstream>
#include <queue>
using namespace std;

#define x first
#define y second
constexpr int MOD = 1000000007;

typedef std::pair<int,int> pii;
typedef long long ll;
typedef unsigned int ui;

template<typename T>std::istream&operator>>(std::istream&i,vector<T>&t) {for(auto&v:t){i>>v;}return i;}
template<typename T>std::ostream&operator<<(std::ostream&o,const vector<T>&t) {for(size_t i=0;i<t.size();++i){o<<t[i]<<" \n"[i == t.size()-1];}return o;}

namespace std {
    template<typename T,typename U>struct hash<pair<T,U>>{hash<T>t;hash<U>u;size_t operator()(const pair<T,U>&p)const{return t(p.x)^(u(p.y)<<7);}};
}
template<typename T,typename F>T bsh(T l,T h,const F&f){T r=-1,m;while(l<=h){m=(l+h)/2;if(f(m)){l=m+1;r=m;}else{h=m-1;}}return r;}
template<typename T,typename F>T bsl(T l,T h,const F&f){T r=-1,m;while(l<=h){m=(l+h)/2;if(f(m)){h=m-1;r=m;}else{l=m+1;}}return r;}
template<typename T> T gcd(T a,T b) { if (a<b) swap(a,b); return b?gcd(b,a%b):a; }

// #include "../l/mod.h"

class D {
public:
	void solve(istream& cin, ostream& cout) {
		int N, K;
		cin >> N >> K;
		vector<int> A(N);
		cin >> A;
		sort(A.begin(), A.end());
		vector<bool> UN(N, true);
		vector<vector<bool>> F(N+1, vector<bool>(K, false));
		vector<vector<int>> O(N+1, vector<int>(K, 1000000));


		F[0][0] = true;
		for (int i = 0; i < N; ++i) {
			for (int j = 0; j < K; ++j) {
				if (F[i][j]) {
					if (j + A[i] < K) F[i+1][j+A[i]] = true;
					else O[i][j] = min(O[i][j], j + A[i]);
					F[i+1][j] = true;
				}
			}
		}


		for (int i = N-1; i >= 0; --i) {
			for (int j = 0; j < K; ++j) {
				if (F[i][j]) {
					F[i][j] = false;

					if (j + A[i] < K && F[i + 1][j + A[i]] && O[i+1][j+A[i]] - A[i] < K) {
						O[i][j] = min(O[i][j], O[i + 1][j + A[i]]);
						UN[i] = false;
						F[i][j] = true;
					}

					if (F[i+1][j]) {
						O[i][j] = min(O[i][j], O[i+1][j]);
						F[i][j] = true;
					}

					if (j + A[i] >= K) {
						O[i][j] = min(O[i][j], j + A[i]);
						UN[i] = false;
						F[i][j] = true;
					}
				}
			}
		}
		/*for (int i = 0; i < N + 1; ++i) {
			cerr << F[i];
			cerr << O[i];
		}*/
		/*
		for (int k = 0; k < N; ++k) {
			if (!UN[k]) continue;
			if (A[k] >= K) {
				UN[k] = false;
				continue;
			}

			vector<bool> F(K, false);
			F[0] = true;
			for (int j = 0; j < N && UN[k]; ++j) {
				if (j==k) continue;
				for (int i = K - 1; i >= 0 && UN[k]; --i) {
					if (F[i]) {
						if (i + A[j] >= K) {
							UN[j] = false;
						} else if (i + A[j] >= K - A[k]) {
							UN[k] = false;
							F[i + A[j]] = true;
						} else {
							F[i + A[j]] = true;
						}
					}
				}

			}
		}*/

		cout << count(UN.begin(), UN.end(), true) << endl;
	}
};


int main() {
	ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
	D solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 101504