#include <bits/stdc++.h>
using namespace std;
long long n;
int k;
long long a[105];
long long dp[105][100005];
long long solve(int now, long long mult) {
  if (now == k + 1) return mult;
  if (mult == 0) return 0;
  if (mult < 100005 && dp[now][mult] != -1) return dp[now][mult];
  long long res = 0;
  res = solve(now + 1, mult) - solve(now + 1, mult / a[now]);
  if (mult < 100005) dp[now][mult] = res;
  return res;
}
int main() {
  scanf("%lld%d", &n, &k);
  for (int i = 1; i <= k; i++) scanf("%lld", &a[i]);
  sort(a + 1, a + k + 1, greater<long long>());
  memset(dp, -1, sizeof(dp));
  printf("%lld\n", solve(1, n));
  return 0;
}
