//#pragma GCC optimize("Ofast,unroll-loops")
#include <bits/stdc++.h>
using namespace std;
typedef long long llo;
#define mp make_pair
#define pb push_back
#define a first
#define b second
#define endl '\n'
llo n;
llo it[11];
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cin>>n;
llo k;
cin>>k;
for(llo i=0;i<k;i++){
cin>>it[i];
}
llo ans=0;
for(llo i=1;i<=n;i++){
llo st=0;
llo st2=0;
if(i==n){
st=1;
}
for(llo j=0;j<k;j++){
llo x=i%it[j];
if(x==0){
st=1;
}
else if(x==1){
st2=1;
}
}
if(st==1 and st2==1){
ans++;
}
}
cout<<ans<<endl;
return 0;
}