#include <bits/stdc++.h>
using namespace std;
int k, p[101];
const int N = 3e5;
long long memo[N][101];
long long go(long long x, int from) {
  if (x == 0 || from == k) return x;
  if (x < N && memo[x][from] != -1) return memo[x][from];
  long long res = go(x, from + 1) - go(x / p[from], from + 1);
  if (x < N) memo[x][from] = res;
  return res;
}
int main() {
  long long n;
  scanf("%I64d %d", &n, &k);
  for (int i = 0; i < k; i++) scanf("%d", p + i);
  sort(p, p + k);
  reverse(p, p + k);
  memset(memo, -1, sizeof memo);
  printf("%I64d\n", go(n, 0));
  return 0;
}
