#include <bits/stdc++.h>
using namespace std;
inline const int read() {
  int r = 0, k = 1;
  char c = getchar();
  for (; c < '0' || c > '9'; c = getchar())
    if (c == '-') k = -1;
  for (; c >= '0' && c <= '9'; c = getchar()) r = r * 10 + c - '0';
  return k * r;
}
long long n;
int k, a[110];
bool vis[1000010];
long long dp[110][100000];
long long dfs(int pos, long long n) {
  if (pos == k + 1) return n;
  if (n <= 0) return 0;
  if (n < 100000 && dp[pos][n] != -1) return dp[pos][n];
  long long ans = dfs(pos + 1, n) - dfs(pos + 1, n / a[pos]);
  if (n < 100000) dp[pos][n] = ans;
  return ans;
}
void input() {
  memset(dp, -1, sizeof(dp));
  cin >> n >> k;
  for (int i = (1), _ = (k); i <= _; i++) a[i] = read();
  sort(a + 1, a + k + 1, greater<int>());
}
void solve() { cout << dfs(1, n) << endl; }
int main() {
  input(), solve();
  return 0;
}
