#include using namespace std; long long N, K, Q, A[15009], X[15009], V[15009]; long long dp[15009], mod = 1000000007; int main() { cin >> N >> K; dp[0] = 1; for (int i = 1; i <= N; i++) { cin >> A[i]; if (A[i] >= 1) { for (int j = 15000; j >= A[i]; j--) { dp[j] += dp[j - A[i]]; dp[j] %= mod; } } } cin >> Q; for (int i = 1; i <= Q; i++) { cin >> X[i] >> V[i]; if (A[X[i]] >= 1) { for (int j = A[X[i]]; j <= 15000; j++) { dp[j] -= dp[j - A[X[i]]]; dp[j] = (dp[j] + mod) % mod; } } A[X[i]] = V[i]; if (V[i] >= 1) { for (int j = 15000; j >= V[i]; j--) { dp[j] += dp[j - V[i]]; dp[j] %= mod; } } if (dp[K] == 0) cout << "0" << endl; else cout << "1" << endl; } return 0; }