#include using namespace std; using ll=long long; int main(){ cin.tie(nullptr); ios::sync_with_stdio(false); int n,q; cin>>n>>q; vector a(n); for(int i=0;i>a[i]; set s; for(int i=0;i x,y; auto check=[&](int i)->void{ if(s.count(i)&&s.count(11*i)&&s.count(19*i)&&s.count(29*i))y.insert(i); if(s.count(i)&&s.count(5*i)&&s.count(7*i)&&s.count(11*i))x.insert(i); }; auto uncheck=[&](int i)->void{ if(y.count(i)&&!(s.count(i)&&s.count(11*i)&&s.count(19*i)&&s.count(29*i)))y.erase(i); if(x.count(i)&&!(s.count(i)&&s.count(5*i)&&s.count(7*i)&&s.count(11*i)))x.erase(i); return; }; for(int i:s){ check(i); } while(q--){ int t,p; cin>>t>>p; if(t==1){ s.insert(p); if(p%5==0)check(p/5); if(p%7==0)check(p/7); if(p%11==0)check(p/11); if(p%19==0)check(p/19); if(p%29==0)check(p/29); check(p); }else{ s.erase(p); uncheck(p); if(p%5==0)uncheck(p/5); if(p%7==0)uncheck(p/7); if(p%11==0)uncheck(p/11); if(p%19==0)uncheck(p/19); if(p%29==0)uncheck(p/29); } cout<