Language: C++

#include <bits/stdc++.h>

using namespace std;

int n,k;
vector<int> a;

bool ok(int p) {
	if(a[p]>=k) return true;
	vector<vector<char> > dp(vector<char>(k));
	dp[0][0]=true;
	for(int i=0;i<n;++i) {
		for(int j=0;j<k;++j) {
			dp[i+1][j]|=dp[i][j];
			if(i==p||j+a[i]>=k) continue;
			dp[i+1][j+a[i]]|=dp[i][j];
			if(j+a[i]>=k-a[p]&&dp[i+1][j+a[i]]) return true;
		}
	}
	return false;
}

int main() {
	cin >> n >> k;
	a.resize(n);
	for(auto&e:a) cin >> e;
	sort(a.begin(),a.end());
	int l=-1,r=n;
	while(r-l>1) {
		int mid=(l+r)/2;
		if(ok(mid)) r=mid;
		else l=mid;
	}
	cout << r << endl;
	
	return 0;
}

Compiler output:
a.cc: In function 'bool ok(int)':
a.cc:10:33: warning: parentheses were disambiguated as a function declaration [-Wvexing-parse]
   10 |         vector<vector<char> > dp(vector<char>(k));
      |                                 ^~~~~~~~~~~~~~~~~
a.cc:10:33: note: replace parentheses with braces to declare a variable
   10 |         vector<vector<char> > dp(vector<char>(k));
      |                                 ^~~~~~~~~~~~~~~~~
      |                                 -
      |                                 {               -
      |                                                 }
a.cc:11:13: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   11 |         dp[0][0]=true;
      |             ^
a.cc:11:16: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   11 |         dp[0][0]=true;
      |                ^
a.cc:11:17: error: assignment of read-only location '* dp'
   11 |         dp[0][0]=true;
      |         ~~~~~~~~^~~~~
a.cc:14:31: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   14 |                         dp[i+1][j]|=dp[i][j];
      |                               ^
cc1plus: warning: pointer to a function used in arithmetic [-Wpointer-arith]
a.cc:14:34: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   14 |                         dp[i+1][j]|=dp[i][j];
      |                                  ^
a.cc:14:41: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   14 |                         dp[i+1][j]|=dp[i][j];
      |                                         ^
a.cc:14:44: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   14 |                         dp[i+1][j]|=dp[i][j];
      |                                            ^
a.cc:14:35: error: invalid operands of types 'std::vector<std::vector<char> >(std::vector<char>)' and 'std::vector<std::vector<char> > (*)(std::vector<char>)' to binary 'operator|'
   14 |                         dp[i+1][j]|=dp[i][j];
      |                         ~~~~~~~~~~^~~~~~~~~~
a.cc:14:35: note:   in evaluation of 'operator|=(class std::vector<std::vector<char> >(class std::vector<char>), class std::vector<std::vector<char> > (*)(class std::vector<char>))'
a.cc:16:31: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   16 |                         dp[i+1][j+a[i]]|=dp[i][j];
      |                               ^
cc1plus: warning: pointer to a function used in arithmetic [-Wpointer-arith]
a.cc:16:39: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   16 |                         dp[i+1][j+a[i]]|=dp[i][j];
      |                                       ^
a.cc:16:46: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   16 |                         dp[i+1][j+a[i]]|=dp[i][j];
      |                                              ^
a.cc:16:49: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   16 |                         dp[i+1][j+a[i]]|=dp[i][j];
      |                                                 ^
a.cc:16:40: error: invalid operands of types 'std::vector<std::vector<char> >(std::vector<char>)' and 'std::vector<std::vector<char> > (*)(std::vector<char>)' to binary 'operator|'
   16 |                         dp[i+1][j+a[i]]|=dp[i][j];
      |                         ~~~~~~~~~~~~~~~^~~~~~~~~~
a.cc:16:40: note:   in evaluation of 'operator|=(class std::vector<std::vector<char> >(class std::vector<char>), class std::vector<std::vector<char> > (*)(class std::vector<char>))'
a.cc:17:50: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   17 |                         if(j+a[i]>=k-a[p]&&dp[i+1][j+a[i]]) return true;
      |                                                  ^
cc1plus: warning: pointer to a function used in arithmetic [-Wpointer-arith]
a.cc:17:58: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   17 |                         if(j+a[i]>=k-a[p]&&dp[i+1][j+a[i]]) return true;
      |                                                          ^