#include<stdio.h>
#include<iostream>
#include<algorithm>
using namespace std;
int n,m,i,j,d,g,a[222222],N;
long long nFi,nSe,fi,se,le,ri,mid;
long long rF,rS,ret;
#define base 1000000000000000000LL
void check(int d){
for(int i=2;i<=m;i++)if((a[i]-a[i-1])%d!=0)return;
fi=(a[1]-1)/d;se=(n-a[m])/d;
ret+=(fi+1)*(se+1);
}
int main(){
freopen("trees.in","r",stdin);
freopen("trees.out","w",stdout);
scanf("%d%d",&n,&m);
for(i=1;i<=m;i++)scanf("%d",&a[i]);
sort(a+1,a+m+1);
if(m>1){
g=a[2]-a[1];
for(i=2;i<=m;i++)g=__gcd(g,a[i]-a[i-1]);
for(i=1;i*i<=g;i++)if(g%i==0){
check(i);
if(g/i!=i)check(g/i);
}
cout<<ret<<endl;
}else{
i=1;N=max(a[1]-1,n-a[1]);
while(i<=N){
nFi=(a[1]-1)/i;nSe=(n-a[1])/i;
le=i;ri=n;
while(le<ri){
mid=(le+ri+1)/2;
if((((a[1]-1)/mid)!=nFi)||(((n-a[1])/mid)!=nSe))ri=mid-1;else le=mid;
}
rF+=(long long)(le-i+1)*(nFi+1)*(nSe+1);
i=le+1;
}
cout<<rF-(N-1)<<endl;
}
return 0;
}
I2luY2x1ZGU8c3RkaW8uaD4KI2luY2x1ZGU8aW9zdHJlYW0+CiNpbmNsdWRlPGFsZ29yaXRobT4KdXNpbmcgbmFtZXNwYWNlIHN0ZDsKCmludCBuLG0saSxqLGQsZyxhWzIyMjIyMl0sTjsKbG9uZyBsb25nIG5GaSxuU2UsZmksc2UsbGUscmksbWlkOwpsb25nIGxvbmcgckYsclMscmV0OwoKI2RlZmluZSBiYXNlIDEwMDAwMDAwMDAwMDAwMDAwMDBMTAoKdm9pZCBjaGVjayhpbnQgZCl7Cglmb3IoaW50IGk9MjtpPD1tO2krKylpZigoYVtpXS1hW2ktMV0pJWQhPTApcmV0dXJuOwoJZmk9KGFbMV0tMSkvZDtzZT0obi1hW21dKS9kOwoJcmV0Kz0oZmkr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