#include <iostream>
#include <algorithm>

#define rep(i, n) for(int i = 0; i < (n); i++)

using namespace std;

int v[100005];
int main(){
    int n, k;
    while(cin >> n >> k, n|k){
        rep(i, k) cin >> v[i];
		sort(v, v+k);
        int prev = 0, seq = 0;
        int ans = 0;
        for(int i = 1+!v[0]; i <= k; i++){
            seq++;
            if(v[i] != v[i-1]+1 || i == k){
				if(!v[0]) ans = max(ans, prev+seq+1);
				else ans = max(ans, seq);
                prev = seq;
                seq = 0;
            }
        }
        cout << ans << endl;
    }
	return 0;
}