#include #include using namespace std; using i32 = int; using i64 = long long; using i128 = __int128_t; using f64 = double; using p2 = pair; using p3 = tuple; using mint = atcoder::modint998244353; constexpr i64 inf = 1e18; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(18); _main(); } void _main() { i64 n, q; cin >> n >> q; set st; i64 ans = 0; vector> v; v.push_back({1, 5, 7, 11}); v.push_back({1, 11, 19, 29}); auto add = [&](i64 x) { st.insert(x); for (i64 i = 0; i < v.size(); i++) { for (i64 j = 0; j < v[i].size(); j++) { if (x % v[i][j] != 0) continue; i64 c = x / v[i][j]; bool ok = true; for (i64 k = 0; k < v[i].size(); k++) { ok &= st.count(c * v[i][k]); } ans += ok; } } }; auto del = [&](i64 x) { for (i64 i = 0; i < v.size(); i++) { for (i64 j = 0; j < v[i].size(); j++) { if (x % v[i][j] != 0) continue; i64 c = x / v[i][j]; bool ok = true; for (i64 k = 0; k < v[i].size(); k++) { ok &= st.count(c * v[i][k]); } ans -= ok; } } st.erase(x); }; for (i64 i = 0; i < n; i++) { i64 x; cin >> x; add(x); } for (;q--;) { i64 t, x; cin >> t >> x; if (t == 1) add(x); else del(x); cout << ans << "\n"; } }