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


int main()
{
	int n, m;
	cin >> n >> m;

	if (m == 0)
	{
		cout << 1 << endl;
		return 0;
	}

	vector<int> a(m);
	rep(i, m) cin >> a[i];
	sort(a.begin(), a.end());
	vector<int> d(m+1);
	int mn = 1e9 + 5;
	rep(i, m)
	{
		if (i == 0) d[0] = a[0] - 1;
		else d[i] = a[i] - a[i - 1] - 1;	
		if(d[i] != 0) mn = min(mn, d[i]);
	}
    d[m] = n - a.back();

	int ans = 0;
	rep(i, m+1)
	{
		if (d[i] == 0) continue;
		ans += (d[i] + mn - 1) / mn;
	}
	cout << ans << endl;
	return 0;
}
/*
	Name:
	Author: xiaruize
	Date:
*/
#pragma GCC optimize(2)
#include<bits/stdc++.h>
using namespace std;
#define ull unsigned long long
#define MOD 1000000007
#define ALL(a) (a).begin(), (a).end()
#define forn(i, n) for (int i = 0; i < int(n); i++)
#define form(i,j,n) for(int i=int(j);i<=int(n);i++)
#define pb push_back
#define mk make_pair
#define pii pair<int,int>
#define pis pair<int,string>
#define sec second
#define ll long long
#define fir first
#define sz(a) int((a).size())

int cnt[4][5005];

signed main()
{
 	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
 	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	int n;
	cin>>n;
	string s;
	cin>>s;
	
	for(int i=0;i<n;i++)
	{
		if(i==0)
		{
			cnt[0][i]=0;
			cnt[1][i]=0;
			cnt[2][i]=0;
			cnt[3][i]=0;
		}
		cnt[0][i]=cnt[0][i-1];
		cnt[1][i]=cnt[1][i-1];
		cnt[2][i]=cnt[2][i-1];
		cnt[3][i]=cnt[3][i-1];
		if(s[i]=='A')
			cnt[0][i]++;
		else if(s[i]=='G')
			cnt[1][i]++;
		else if(s[i]=='C')
		    cnt[2][i]++;
		else
			cnt[3][i]++;
	}
	int ans=0;
	for(int i=0;i<n-1;i++)
	{
		for(int j=i+1;j<n;j++)
		{
			if(cnt[0][j]-cnt[0][i-1]\
			==cnt[3][j]-cnt[3][i-1]&&\
			cnt[1][j]-cnt[1][i-1]\
			==cnt[2][j]-cnt[2][i-1])
				ans++;
		}
	}
	cout<<ans<<endl;
	return 0;
}