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

int main(){
  int i,j,n,k,a[100000],b,ans;
  bool f;
  while(1){
    cin >> n >> k;
    if(n == 0 && k == 0) break;
    f = false;
    for(i=0;i<k;i++){
      cin >> a[i];
      if(a[i] == 0) f = true;
    }
    sort(a,a+k);

    ans = 1;
    b = 1;
    for(i=1;i<k;i++){
      if(a[i-1] == 0) continue;
      else if(a[i] == a[i-1] + 1) b++;
      else if(f){
	b++;
	if(a[i] == a[i-1] + 2){
	  b++;
	  for(j=i+1;j<k;j++){
	    if(a[j] != a[j-1] + 1) break;
	    b++;
	  }
	}
	ans = max(ans,b);
	b = 1;
      }
      else if(!f){
	ans = max(ans,b);
	b = 1;
      }
    }
    cout << ans << endl;
  }
  return 0;
}