#include using namespace std; const long long MOD = 998244353; int main(){ int N, K; cin >> N >> K; vector A(N); for (int i = 0; i < N; i++){ cin >> A[i]; } vector dp(K + 1, 0); dp[0] = 1; for (int i = 0; i < N; i++){ vector dp2 = dp; for (int j = 0; j <= K - A[i]; j++){ dp2[j + A[i]] += dp[j]; dp2[j + A[i]] %= MOD; } swap(dp, dp2); } if (dp[K] == 0){ cout << -1 << endl; } else { int ans = 0; for (int i = 0; i < N; i++){ vector tmp = dp; for (int j = 0; j <= K - A[i]; j++){ tmp[j + A[i]] -= tmp[j]; tmp[j + A[i]] += MOD; tmp[j + A[i]] %= MOD; } if (tmp[K] == 0){ ans++; } } cout << ans << endl; } }