#include <bits/stdc++.h>
using namespace std;
long long m, mem[((long long)101 * 1000)][((long long)102)];
long long k, a[((long long)102)];
long long calc(long long n, long long x) {
  if (n < ((long long)101 * 1000) && mem[n][x] != -1) return mem[n][x];
  if (x == -1) return n;
  long long res = calc(n, x - 1) - calc(n / a[x], x - 1);
  if (n < ((long long)101 * 1000)) mem[n][x] = res;
  return res;
}
int main() {
  memset(mem, -1, sizeof mem);
  cin >> m >> k;
  for (int i = 0; i < k; i++) cin >> a[i];
  sort(a, a + k);
  cout << calc(m, k - 1);
  return 0;
}
