#include <iostream>
#include <algorithm>
using namespace std;
int main(){
int n;
int k;
int b;
int c;
int d;
int e;//ワイルドカードの値
while(cin >>n){
cin >>k;
if(n==0){break;}
int a[k];
b=0;
while(b<k){
cin >>a[b];
b=b+1;}
sort(a,a+b);
c=1;
d=0;
if(a[0]!=0){
b=1;
while(b<k){
if(a[b]==a[b-1]+1){c=c+1;}
else{if(d<c){d=c;} c=1;}
b=b+1;}}
if(a[0]==0){
e=0;
b=2;
if(a[1]!=1){c=2; e=a[1]-1;}
while(b<k){
if(a[b]==a[b-1]+1){c=c+1;}
else if(a[b]==a[b-1]+2){c=a[b]-e; e=a[b]-1;}
else{c=2; e=a[b]-1;}
if(d<c){d=c;}
b=b+1;}
if(a[k-1]!=n){c=a[b]+1-e; if(d<c){d=c;}}}
cout <<d<<endl;}}