#include using namespace std; void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); } int main() { fast_io(); int n, k; cin >> n >> k; vector a(n); bitset<200001> dp; dp[0] = 1; for (int i = 0; i < n; i++) { cin >> a[i]; dp |= dp << a[i]; } if (dp[k]) { int ans = 0; for (int i = 0; i < n; i++) { if (!dp[k + a[i]]) { ans++; } } cout << ans << endl; } else { cout << -1 << endl; } }