#include namespace { #pragma GCC diagnostic ignored "-Wunused-function" #include #pragma GCC diagnostic warning "-Wunused-function" using namespace std; using namespace atcoder; #define rep(i,n) for(int i = 0; i < (int)(n); i++) #define rrep(i,n) for(int i = (int)(n) - 1; i >= 0; i--) #define all(x) begin(x), end(x) #define rall(x) rbegin(x), rend(x) template bool chmax(T& a, const T& b) { if (a < b) { a = b; return true; } else return false; } template bool chmin(T& a, const T& b) { if (b < a) { a = b; return true; } else return false; } using ll = long long; using P = pair; using VI = vector; using VVI = vector; using VL = vector; using VVL = vector; } int main() { ios::sync_with_stdio(false); cin.tie(0); int n, q; cin >> n >> q; set st; array, 2> d{array{1,5,7,11}, array{1,11,19,29}}; auto cnt = [&](ll x) { int ans = 0; rep(i, 2) rep(j, 4) if (x % d[i][j] == 0) { ll mul = x / d[i][j]; bool ok = true; rep(j, 4) { ll v = d[i][j] * mul; if (!st.contains(v)) { ok = false; break; } } ans += ok; } return ans; }; int ans = 0; rep(i, n) { ll x; cin >> x; st.insert(x); ans += cnt(x); } rep(_, q) { ll t, x; cin >> t >> x; if (t == 1) { st.insert(x); ans += cnt(x); } else { ans -= cnt(x); st.erase(x); } cout << ans << '\n'; } }