#include <bits/stdc++.h>
using namespace std;
long long n, dp[110][200010];
int k, a[110];
inline long long solve(int m, long long n) {
  if (m > k || n == 0) return n;
  if (n <= 200000 && dp[m][n] != -1) return dp[m][n];
  long long ans = solve(m + 1, n) - solve(m + 1, n / a[m]);
  if (n <= 200000) dp[m][n] = ans;
  return ans;
}
int main() {
  scanf("%lld%d", &n, &k);
  for (int i = 1; i <= k; i++) scanf("%d", &a[i]);
  sort(a + 1, a + k + 1);
  reverse(a + 1, a + k + 1);
  memset(dp, 255, sizeof(dp));
  printf("%lld\n", solve(1, n));
  return 0;
}
