#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
#define REP(i,n) for(ll i=0;i<(n);i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORC(i,a,b,c) for(ll i=(a);i<(b);i+=(c))
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define ff first
#define ss second
#define dd long double
#define all(x) x.begin(),x.end()

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n,m;
    cin>>n>>m;
    if(m==0){
        cout<<1<<endl;
        return 0;
    }
    vector<ll> arr(m);
    REP(i,m){
        cin>>arr[i];
        arr[i]--;
    }
    if(n==m){
        cout<<0<<endl;
        return 0;
    }
    sort(all(arr));
    vector<ll> gaps;
    if(arr[0]){
        gaps.pb(arr[0]);
    }
    for(ll i=1;i<m;i++){
        ll x=arr[i]-arr[i-1]-1;
        if(x){
            gaps.pb(x);
        }
    }
    if(n-arr.back()-1!=0){
        gaps.pb(n-arr.back()-1);
    }
    sort(all(gaps));
    ll x=gaps[0];
    ll ans=0;
    for(ll i=0;i<int(gaps.size());i++){
        ll temp=gaps[i];
        temp=temp%x?temp/x+1:temp/x;
        ans+=temp;
    }
    cout<<ans<<endl;
}

#include<cstdio>
#include<algorithm>
#include<cstring>
#include<iostream>
#include<queue>
#include<cmath>
#include<stack>
#include <map>
#include <vector>
using namespace std;
int main(){
	int n,m,p=0,mp[10][10],ad=0,k=0;
	cin>>n>>m;
	for(int i=0;i<n;i++){
		for(int j=0;j<n;j++){
			cin>>mp[i][j];
		}
	}
	int a[10]={0,1,2,3,4,5,6,7,8,9};
	while(p==0){
		ad=0;
		for(int i=1;i<n;i++){
			ad+=mp[a[i]][a[i-1]];
		}
		ad+=mp[a[n-1]][0];
		//cout<<ad<<endl;
		if(ad==m)k++;
		next_permutation(a,a+n);
		p=1;
		if(a[0]==0)p=0;
	}
	cout<<k;
	return 0;
}