// 2011/09/28 Tazoe

#include <iostream>
using namespace std;

int main()
{
	while(true){
		int n, k;
		cin >> n >> k;
		if(n==0&&k==0)
			break;

		int C[100003] = {0};
		for(int i=0; i<k; i++){
			int c;
			cin >> c;
			C[c] = 1;
		}

		int max = 1;

		if(C[0]==0){
			int sum = 0;
			for(int i=1; i<=n+1; i++)
				if(C[i]==1)
					sum++;
				else{
					if(max<sum)
						max = sum;
					sum = 0;
				}
			cout << max << endl;
			continue;
		}

		if(C[0]==1){
			int sum = 0;
			int sum2 = 0;
			for(int i=1; i<=n+2; i++)
				if(C[i]==1){
					sum++;
					sum2++;
				}
				else{
					if(max<sum2)
						max = sum2;
					sum2 = sum;
					sum2++;
					sum = 0;
				}
			cout << max << endl;
			continue;
		}
	}

	return 0;
}