#include using namespace std; using ll = long long; using vl = vector; using vvl = vector; using vvvl = vector; #define rep(i, n) for (int i = 0; i < n; i++) #define all(x) x.begin(), x.end() constexpr ll dx[] = {1, 0, -1, 0, 1, -1, -1, 1}; constexpr ll dy[] = {0, 1, 0, -1, 1, 1, -1, -1}; struct Init { Init() { ios::sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(15); } } init; template ostream& operator<<(ostream& os, const pair& pair_var) { os << pair_var.first << " " << pair_var.second; return os; } template ostream& operator<<(ostream& os, const vector& vec) { rep(i, vec.size()) { os << vec[i]; if (i != vec.size() - 1) os << " "; } return os; } template ostream& operator<<(ostream& os, const vector>& vec) { rep(i, vec.size()) { os << vec[i]; if (i != vec.size() - 1) os << " "; } return os; } int main() { ll n, q; cin >> n >> q; set st; rep(i, n) { ll x; cin >> x; st.insert(x); } ll ans = 0; vector> vv = {{1, 5, 7, 11}, {1, 11, 19, 29}}; for (auto x : st) { for (auto k : vv) { for (auto j : k) { if (x % j == 0) { ll base = x / j; bool f = true; for (auto l : k) { if (st.count(l * base) == 0) f = false; } if (f) ans += 1; } } } } ans /= 4; rep(i, q) { int t, x; cin >> t >> x; if (t == 1) { st.insert(x); for (auto k : vv) { for (auto j : k) { if (x % j == 0) { ll base = x / j; bool f = true; for (auto l : k) { if (st.count(l * base) == 0) f = false; } if (f) ans += 1; } } } } else { for (auto k : vv) { for (auto j : k) { if (x % j == 0) { ll base = x / j; bool f = true; for (auto l : k) { if (st.count(l * base) == 0) f = false; } if (f) ans -= 1; } } } st.erase(x); } cout << ans << endl; } return 0; }