#include <bits/stdc++.h>
using namespace std;
const int maxk = 1e2 + 1, maxn = 5e5 + 1, inf = 1e9;
long long n;
int dp[maxn][maxk], k, q[maxn];
long long solve(long long a, int b) {
  if (a < maxn && dp[a][b] != -1) {
    return dp[a][b];
  }
  if (a == 0) {
    return 0;
  }
  if (b == 0) {
    return a;
  }
  long long res = solve(a, b - 1) - solve(a / q[b], b - 1);
  if (a < maxn) {
    dp[a][b] = res;
  }
  return res;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  for (int i = 0; i < maxn; i++) {
    for (int j = 0; j < maxk; j++) {
      dp[i][j] = -1;
    }
  }
  cin >> n >> k;
  for (int i = 1; i <= k; i++) {
    cin >> q[i];
  }
  sort(q + 1, q + k + 1);
  cout << solve(n, k) << endl;
  return 0;
}
