#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
using namespace std;

#define MAX 100010

int main(){
  int n, k;
  int v[MAX], dp[MAX];
  int tmp;
  while(cin >> n >> k){
    if(n == 0 && k == 0) break;
    memset(v, 0, sizeof(v));
    memset(dp, 0, sizeof(dp));
    bool is_0 = false;
    
    for(int i = 0 ; i < k ; i++){
      cin >> tmp;
      if(tmp == 0){
	is_0 = true;
	continue;
      }
      v[tmp] = 1;
      dp[tmp] = 1;
    }
    
    int ans = 0;
   
    for(int i = 0 ; i < n ; i++){
      if(v[i] == v[i+1] && v[i] == 1) dp[i+1] = dp[i] + 1;
      ans = max(ans, dp[i+1]);
    }
  
    if(is_0){
      for(int i = 1 ; i <= n ; i++){
	if(v[i] == 0){
	  v[i] = 1;
	  int cnt = 1, t1 = i-1, t2 = i+1;
	  while(v[t1] == 1){
	    t1--;
	    if(t1 < 0) break;
	    cnt++;
	  }
	  while(v[t2] == 1){
	    t2++;
	    if(t2 > n+1) break;
	    cnt++;
	  }
	  v[i] = 0;
	  ans = max(ans, cnt);
	}
      }
    }
    cout << ans << endl;    
  }
  return 0;
}