#include <bits/stdc++.h>
using namespace std;
const int N=3e5+10;
const int mod = 998244353;
typedef long long ll;
typedef unsigned long long ull;
int m,q;
ll cnt[N];
set<int>st;

void solve()
{
    cin>>m>>q;
    while(q--)
    {
        int op,x;
        cin>>op>>x;
        if(op==1)
        {
            if(cnt[x]==0)
            {
                if(x-3>=1)st.insert(x-3);
                if(x+3<=m)st.insert(x+3);
            }
            cnt[x]++;
        }
        else 
        {
            if(cnt[x]==1)
            {
                if((x-6<1)||(x-6>=1&&cnt[x-6]==0))
                {
                    st.erase(x-3);
                }


                if((x+6>m)||(x+6<=m&&cnt[x+6]==0))
                {
                    st.erase(x+3);
                }
            }
            cnt[x]--;
        }
        cout<<st.size()<<'\n';
    }

}

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int t=1;
    // cin>>t;
    while(t--)
    {
        solve();

    }


    return 0;
}

模拟即可