#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 5;
const int mod = 998244353;
int a[105], dp[105][maxn];
long long dfs(int pos, long long x) {
  if (!pos) return x;
  if (x < maxn && dp[pos][x] != -1) return dp[pos][x];
  long long res = dfs(pos - 1, x) - dfs(pos - 1, x / a[pos]);
  if (x < maxn) dp[pos][x] = res;
  return res;
}
int solve() {
  long long n;
  int k, cnt(0);
  scanf("%lld", &n);
  scanf("%d", &k);
  for (int i = (1); i < (k + 1); ++i) scanf("%d", &a[i]), cnt += a[i] == 1;
  if (cnt) return printf("0\n");
  sort(a + 1, a + k + 1);
  memset(dp, -1, sizeof(dp));
  return printf("%lld\n", dfs(k, n));
}
int main() { solve(); }
