#include<bits/stdc++.h>
using namespace std;
using ll=long long;
int main(){
ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
ll m,q;
cin>>m>>q;
// ans:记录每个安全牌x的有效支撑数,键为安全牌x,值为支撑数(>0表示x是安全牌)
unordered_map<ll,ll>ans;
while(q--){
ll op,t;
cin>>op>>t;
if(op==1){
// t的存在,为x = t-3 提供了一个安全支撑(x+3 = t)
if(t-3>=1){
ans[t-3]++;
}
// t的存在,为x = t+3 提供了一个安全支撑(x-3 = t)
if(t+3<=m){
ans[t+3]++;
}
}else if(op==2){
// t的移除,减少了x = t-3 的一个安全支撑
if(t-3>=1){
ans[t-3]--;
// 若支撑数为0,x = t-3 不再是安全牌,从ans中移除
if(ans[t-3]==0){
ans.erase(t-3);
}
}
// t的移除,减少了x = t+3 的一个安全支撑
if(t+3<=m){
ans[t+3]--;
// 若支撑数为0,x = t+3 不再是安全牌,从ans中移除
if(ans[t+3]==0){
ans.erase(t+3);
}
}
}
// ans的大小即为当前安全牌的数量
cout<<ans.size()<<'\n';
}
return 0;
}