#include<bits/stdc++.h>
#define rep(i,n) for ( int i=0; i< (n); ++i )
using namespace std;
using ll = long long;
using P = pair<int,int>;


int main(){
    ll n;
    int m;
    cin >> n >> m;
    vector<ll> a(m),sec(0);
    rep(i,m) cin >> a[i];
    a.push_back(n+1);a.push_back(0);
    sort(a.begin(),a.end());
    rep(i,m+1){
        ll si = a[i+1]-a[i]-1;
        if(si>0) sec.push_back(si);
    }
    ll k = *min_element(sec.begin(),sec.end());
    ll ans = 0;
    for( ll si : sec ) ans += (si+k-1)/k; 
    // if sec%k >0 => +1
    cout << ans << endl;
    return 0;
}

#include <bits/stdc++.h>
#define all(V) V.begin(),V.end()
#define pi 3.1415926535897932384626
#define fi fixed<<setprecision(13)
#define MOD 1000000007
#define ll long long 
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define REP(i, n) for (ll i = 1; i <=(ll)(n); i++)
#define reps(i,k,n) for (ll i = (ll)k; i < (ll)(n); i++)
using namespace std;
template<class T> void chmin(T& a,T b){ if(a > b) a=b; }
template<class T> void chmax(T& a,T b){ if(a < b) a=b; }
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){fill( (T*)array, (T*)(array+N), val );}
ll nck(ll a,ll b){
  ll s=1,x=1;
  rep(i,b) s=(s*(a-i))/x,x++;
   return s;
}
const ll infll=1LL<<62;
const ll inf=1<<30;
int main(){
  int n,m;cin>>n>>m;
  vector<int> a(n);
  map<int,int> b;
  rep(i,n){
    cin>>a[i];
    if(i<m&&a[i]<m) b[a[i]]++;
  }
  int mi=inf,ma=0;
  bool mio=false;
  rep(i,m){
    if(b[i]==0){
      mi=i;
      mio=1;
      break;
    }
  }
  if(mio==false) ma=m;
  reps(i,m,n){
    int s=a[i],t=a[i-m];
    b[s]++;
    b[t]--;
    if(b[t]==0&&mi>s) mi=t,ma=t;
  }
  if(!mio) cout<<ma;
  else cout<<mi;
}
/*制約を確認しろllじゃなくて大丈夫か？*/
