#include <bits/stdc++.h>
using namespace std;
#pragma comment(linker, "/STACK:100000000")
int a[105];
int b[500005][105];
int xsolve(int n, int k) {
  if (b[n][k] != -1) return b[n][k];
  if (k == 0) return b[n][k] = n;
  if (n == 0) return b[n][k] = 0;
  b[n][k] = xsolve(n, k - 1) - xsolve(n / a[k - 1], k - 1);
  return b[n][k];
}
long long solve(long long n, int k) {
  if (k == 0) return n;
  if (n <= 500000) {
    return xsolve((int)n, k);
  }
  return solve(n, k - 1) - solve(n / a[k - 1], k - 1);
}
int main() {
  long long n;
  int k;
  int i;
  scanf("%I64d%d", &n, &k);
  for (i = 0; i < k; ++i) scanf("%d", &a[i]);
  sort(a, a + k);
  memset(b, 0xff, sizeof(b));
  printf("%I64d\n", solve(n, k));
  return 0;
}
