//给集合m,问小于n的数中有多少数能被集合m中任意一个数整除
//利用容斥原理可知
//ans = 被一个数整除的数的个数 - 被两个数的最小公倍数整除的数的个数 + 被三个数的。。。
#include<cstdio>
#include<cstring>
#include<iostream>
using namespace std ;
const int maxn = 110 ;
typedef __int64 ll ;
int a[maxn] ;
int len ;
int n , m ;
ll gcd(ll a , ll b)
{
if(b == 0)
return a ;
return gcd(b, a%b) ;
}
int dfs(int pos , ll lcm)
{
int ans = 0 ;
for(int i = pos ;i <= len;i++)
{
ll lcm_n = lcm*a[i]/gcd(lcm , a[i]) ;//最小公倍数可能会爆int,被坑了一下
ans += (n-1)/lcm_n - dfs(i+1 , lcm_n) ;
}
return ans ;
}
int main()
{
while(~scanf("%d%d" , &n , &m))
{
len = 0 ;
for(int i = 1;i <= m;i++)
{
int t ;
scanf("%d" , &t) ;
if(!t) continue ;//可能会有0
a[++len] = t ;
}
int ans = dfs(1 , 1) ;
printf("%d\n" , ans) ;
}
return 0 ;
}