#include<cstdio>
#include<cstring>
#define max(a,b) (a>b?a:b)
int main(){
	int k[100001],a,b,table[2][100001];
	while(scanf("%d%d",&a,&b),a,b){
	memset(k,0,sizeof(k));
	memset(table,0,sizeof(table));
		for(int i=0;i<b;i++){
			int c;
			scanf("%d",&c);k[c]=1;
		}	
		int res=0;
		for(int i=1;i<=a;i++){
			if(k[i]){
				table[0][i]=table[0][i-1]+1;
				table[1][i]=table[1][i-1]+1;
			}
			else{
				if(k[0]){
					table[1][i]=table[0][i-1]+1;
				}
			}
			res=max(res,max(table[0][i],table[1][i]));
		}
		printf("%d\n",res);
	}
	return 0;
}