#include <bits/stdc++.h>
using namespace std;
int prime[110];
int dp[300000][100];
int total;
long long solve(long long n, int dep) {
  if (n == 0) return 0;
  if (dep == -1) return n;
  if (n < 300000 && dp[n][dep] != -1) return dp[n][dep];
  long long val = solve(n, dep - 1) - solve(n / prime[dep], dep - 1);
  if (n < 300000) dp[n][dep] = val;
  return val;
}
int main() {
  memset(dp, -1, sizeof(dp));
  long long n;
  scanf("%I64d%d", &n, &total);
  for (int i = 0; i < total; ++i) scanf("%d", prime + i);
  sort(prime, prime + total);
  long long res = solve(n, total - 1);
  printf("%I64d\n", res);
  return 0;
}
