#include<bits/stdc++.h>
#define pb push_back
#define int long long
using namespace std;
int tt,n,p=200001;
void solve(){
	cin>>n;
	int ax[n],ay[n];
	for(int i=0;i<n;i++){
		cin>>ax[i]>>ay[i];
		ax[i]*=p;ax[i]+=i;
		ay[i]*=p;ay[i]+=i;
	}
	sort(ax,ax+n);sort(ay,ay+n);
	set<int> s;
	s.insert((ax[n-1]%p+p)%p);
	s.insert((ax[0]%p+p)%p);
	s.insert((ay[n-1]%p+p)%p);
	s.insert((ay[0]%p+p)%p);
	for(int i=0;i<n;i++){
	    if(ax[i]<0)ax[i]-=p;
	    if(ay[i]<0)ay[i]-=p;
	}
	if(s.size()==2){
		int ans=ax[n-1]/p-ax[1]/p;
		ans=max(ans,ax[n-2]/p-ax[0]/p);
		ans=max(ans,ay[n-1]/p-ay[1]/p);
		ans=max(ans,ay[n-2]/p-ay[0]/p);
		cout<<ans<<'\n';
		return;
	}
	vector<int> v;
	v.pb(ax[n-1]/p-ax[0]/p);
	v.pb(ay[n-1]/p-ay[0]/p);
	v.pb(ax[n-2]/p-ax[0]/p);
	v.pb(ax[n-1]/p-ax[1]/p);
	v.pb(ay[n-1]/p-ay[1]/p);
	v.pb(ay[n-2]/p-ay[0]/p);
	sort(v.begin(),v.end());
	cout<<v[4]<<'\n';
	}

signed main(){
    #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    #endif
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    
    //cin>>tt;
    //while(tt--)
    solve();
}
/*pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")*/
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; i++)
#define RFOR(i, a, n) for (ll i = (ll)n - 1; i >= (ll)a; i--)
#define rep(i, n) FOR(i, 0, n)
#define rrep(i, n) RFOR(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define bra(first, second) '(' << first << ',' << second << ')'
constexpr ll MOD = 1000000007;
//constexpr ll MOD = 998244353;
ll INF = 1001001001001001001;
long double EPS = 1e-7;
long double PI = 3.141592653589793238;
template <typename T>
void remove(std::vector<T> &vector, unsigned int index)
{
   vector.erase(vector.begin() + index);
}

using Graph = vector<vector<pair<ll,ll>>>;

// MOD確認

ll N,M;
ll A[200010];

int main(){
   cin >> N >> M;
   rep(i,M) cin >> A[i+1];
   A[0] = 0;
   A[M+1] = N+1;
   sort(A,A+M+2);
   ll m = INF;
   if(M == 0){
      cout << 1 << endl;
      return 0;
   }
   rep(i,M+1){
      if(A[i+1] != A[i]+1) m = min(m,A[i+1]-A[i]-1);
   }
   ll ans = 0;
   /*if(m == 1){
      cout << N - M << endl;
      return 0;
   }*/
   rep(i,M+1){
      if(A[i+1] != A[i]+1) ans += (A[i+1] - A[i] + m - 2) / m;
   }
   cout << ans << endl;
}
