#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<cstdlib>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pr;
const double pi=acos(-1);
#define rep(i,a,n) for(int i=a;i<=n;i++)
#define per(i,n,a) for(int i=n;i>=a;i--)
#define Rep(i,u) for(int i=head[u];i;i=Next[i])
#define clr(a) memset(a,0,sizeof a)
#define pb push_back
#define mp make_pair
#define putk() putchar(' ')
ld eps=1e-9;
ll pp=1000000007;
ll mo(ll a,ll pp){if(a>=0 && a<pp)return a;a%=pp;if(a<0)a+=pp;return a;}
ll powmod(ll a,ll b,ll pp){ll ans=1;for(;b;b>>=1,a=mo(a*a,pp))if(b&1)ans=mo(ans*a,pp);return ans;}
ll gcd(ll a,ll b){return (!b)?a:gcd(b,a%b);}
ll read(){
ll ans=0;
char last=' ',ch=getchar();
while(ch<'0' || ch>'9')last=ch,ch=getchar();
while(ch>='0' && ch<='9')ans=ans*10+ch-'0',ch=getchar();
if(last=='-')ans=-ans;
return ans;
}
void put(ll a){
if(a<0)putchar('-'),a=-a;
int top=0,q[20];
while(a)q[++top]=a%10,a/=10;
top=max(top,1);
while(top--)putchar('0'+q[top+1]);
}
//head
ll ans=0;
int n,m,a[25];
ll Gcd(ll a,ll b){
if(!b)return a;
return gcd(b,a%b);
}
void dfs(int dep,ll t,int flag){
if(t>n)return;
if(dep==m+1){
ans+=n/t*flag;
return;
}
dfs(dep+1,t,flag);
dfs(dep+1,t/Gcd(t,a[dep])*a[dep],-flag);
}
int main(){
n=read();
m=read();
rep(i,1,m)a[i]=read();
dfs(1,1,1);
cout<<ans<<endl;
return 0;
}