#include <iostream>
#include <algorithm>
using namespace std;

int main(void){
	int n,k;

	while(cin>>n>>k && (n || k)){
		int count[n+1];
		fill(count,count+n+1,0);
		for(int i=0;i<k;i++){
			int x;
			cin>>x;
			count[x]++;
		}

		int maxLen = 0;
		for(int i=1;i<=n;i++){
			bool cardFlg = count[0];
			int j,index=-1;
			for(j=i;j<=n && (count[j]!=0 || cardFlg);j++){
				if(count[j] == 0 && cardFlg){
					index = j;
					cardFlg = false;
				}
			}
			maxLen = max(maxLen,j-i);
			if(index == -1) i = j;
			else i = index;
		}
		cout<<maxLen<<endl;
	}

	return 0;
}