#include "bits/stdc++.h"
#define MOD 1000000007
#define INF 11234567890
#define in std::cin
#define out std::cout
#define rep(i,N) for(int i=0;i<N;++i)
typedef long long int LL;

int n, k, a[112345];
bool flag, tmp;
int res, ans;

int main()
{
	while (true)
	{
		memset(a, 0, sizeof(a));
		res = ans = 1;

		in >> n >> k;
		if (n == 0 && k == 0) { break; }
		rep(i, k) { in >> a[i]; }

		std::sort(a, a + k);
		tmp = flag = (a[0] == 0 ? true : false);
		rep(i, k - 1)
		{
			if (a[i] == 0) { continue; }
			if (a[i] + 1 == a[i + 1]) { ++res; }
			else if (a[i] + 2 == a[i + 1] && tmp)
			{
				res += 2;
				tmp = false;
			}
			else
			{
				ans = std::max(ans, res);
				res = 1;
				tmp = flag;
				if (a[i] + 1 == a[i + 1]) { ++res; }
				else if (a[i] + 2 == a[i + 1] && tmp)
				{
					res += 2;
					tmp = false;
				}
			}
		}
		out << std::max(ans, res) << std::endl;
	}
	return 0;
}