#include <bits/stdc++.h>
#define sz(x) ((int)x.size())
#define a3 array<int, 3>
using namespace std;
const int oo = 2e9;
const int M = 20;
#ifdef _LOCAL
const int N = int(1.5e8);
#else
const int N = int(5e6) + 10;
#endif
bitset<N> mrk;
int n, m, a[M], ans = 0;
int main(){
ios_base::sync_with_stdio(0); cin.tie(0);
#ifdef _LOCAL
freopen("in.txt","r",stdin);
#endif // _LOCAL
cin >> n >> m;
mrk[n] = 1;
for (int i = 0; i < m; i++){
cin >> a[i];
for (int j = a[i]; j <= n; j += a[i])
mrk[j] = 1;
}
for (int i = n; i > 1; i--)
if (mrk[i] && mrk[i - 1])
ans++;
cout << ans;
return 0;
}