#include<bits/stdc++.h> #define int long long usingnamespace std;
constint N = 2e6 + 66;
inlineintread() { ints(0), w(1); char ch = getchar(); while (ch < '0' || ch > '9') {if (ch == '-') w = -1; ch = getchar();} while (ch >= '0' && ch <= '9') s = s * 10 + ch - '0', ch = getchar(); return s * w; }
inlinevoidput(int x) { if (! x) putchar('0'); if (x < 0) putchar('-'), x = -x; intnum(0); char c[66]; while (x) c[++ num] = x % 10 + 48, x /= 10; while (num) putchar(c[num --]); return (void)(putchar('\n')); }
int a[N], v[N];
inlineintgcd(int a, int b){return ! b ? a : gcd(b, a % b);}
inlineintlcm(int a, int b){return a * b / gcd(a, b);} /* inline void dfs(int dep, int t, int flag) { if (t > n) return; if (dep == m + 1) return (void)(res += n / t * flag); dfs(dep + 1, t, flag); dfs(dep + 1, lcm(t, a[dep]), -flag); return; } */ inlinevoiddfs(int t, int dep, int flag) { if (t > n) return; if (dep == m + 1) return (void)(res += n / t * flag); dfs(t, dep + 1, flag); dfs(lcm(t, a[dep]), dep + 1, -flag); return; }
signedmain() { int i, t, res(0); int n = read(), m = read(); for (i = 1; i <= m; ++ i) a[i] = read(); dfs(1, 1, 1); put(res); return0; }