#include <iostream>
#include <algorithm>
#include <cstring>

constexpr int MAX_N=100000;

int n,k;
int dp[MAX_N+1][2];//???????????????????????????????????°???????????????????´?????????????????????£???????????????
bool IsNum[MAX_N+1];
bool IsWhiteCard;

int main(){
	while(std::cin>>n>>k){
		if(n+k==0)
			break;
		std::memset(dp,0,sizeof(dp));
		std::memset(IsNum,0,sizeof(IsNum));
		int a;
		for(int i=0;i<k;++i){
			std::cin>>a;
			if(a==0)
				IsWhiteCard=true;
			else
				IsNum[a]=true;
		}

		for(int i=1;i<=n;++i) {
			if(IsNum[i]){
				dp[i][0]=dp[i-1][0]+1;
				dp[i][1]=dp[i-1][1]+1;
			}
		else if(IsWhiteCard)
			dp[i][1]=dp[i-1][0]+1;
		}
		int ans=0;
		for(int i=1;i<=n;++i){
			ans=std::max(ans,dp[i][1]);
		}
		std::cout<<ans<<std::endl;
	}
	return 0;
}