#include <bits/stdc++.h>
using namespace std;
const int bound = 100000;
long long f[110][bound];
int a[110];
long long solve(long long n, int k) {
  if (k == 0) return n;
  if (n < bound && f[k][n] >= 0) return f[k][n];
  long long ans = solve(n, k - 1) - solve(n / a[k - 1], k - 1);
  if (n < bound) f[k][n] = ans;
  return ans;
}
int main() {
  memset(f, 255, sizeof(f));
  long long n;
  int k;
  scanf("%I64d%d", &n, &k);
  for (int i = 0; i < k; i++) scanf("%d", &a[i]);
  sort(a, a + k);
  printf("%I64d\n", solve(n, k));
  return 0;
}
