#include<bits/stdc++.h>
using namespace std;
#define int long long
struct node
{
int l,r,h,s,ans,len;
}a[1000001];
void clca(int x,int k)
{
a[x].ans=1;
a[x].s=1;
a[x].h=1;
a[x].l=k;
a[x].r=k;
}
inline int max(int x,int y)
{
return x>y?x:y;
}
void pushdown(int x)
{
a[x].ans=max(a[x+x].ans,a[x+x+1].ans);
if(a[x+x].r^a[x+x+1].l)
a[x].ans=max(a[x].ans,a[x+x].h+a[x+x+1].ans);
a[x].l=a[x+x].l;
a[x].r=a[x+x+1].r;
if(a[x+x].s==a[x+x].len&&a[x+x].r^a[x+x+1].l)
a[x].s=a[x+x].s+a[x+x+1].s;
else a[x].s=a[x+x].s;
if(a[x+x+1].h==a[x+x+1].len&&a[x+x].r^a[x+x+1].l) a[x].h=a[x+x+1].h+a[x+x].h;
else a[x].h=a[x+x+1].h;
}
void buildtree(int q,int l,int r)
{
a[q].len=a[q].r-a[q].l+1;
if(l==r)
{
clca(q,0);
return;
}
int mid=l+r>>1;
buildtree(q+q,l,mid);
buildtree(q+q+1,mid+1,r);
pushdown(q);
}
void Change(int x,int l,int r,int p)
{
if(l==r)
{
clca(x,!a[x].l);
return;
}
int mid=l+r>>1;
if(p<=mid) Change(x+x,l,mid,p);
else Change(x+x+1,mid+1,r,p);
pushdown(x);
}
signed main()
{
register int n,m,x;
scanf("%lld %lld",&n,&m);
buildtree(1,1,n);
while(m--)
{
scanf("%lld",&x);
Change(1,1,n,x);
printf("%lld\n",a[1].ans);
}
return 0;
}
只有十六分,555555......