#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
const long double eps = 1e-7;
const int inf = 1000000010;
const long long INF = 10000000000000010LL;
const int mod = 1000000007;
const int MAXN = 110, TOF = 550000;
long long n, m, k, u, v, x, y, t, a, b, ans;
long long A[MAXN];
int dp[MAXN][TOF];
long long solve(int i, long long j) {
  if (j < TOF && dp[i][j] != -1) return dp[i][j];
  if (i == 0) return j;
  if (j <= 1) return j;
  long long ans = solve(i - 1, j) - solve(i - 1, j / A[i]);
  if (j < TOF) dp[i][j] = ans;
  return ans;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  memset(dp, -1, sizeof(dp));
  cin >> n >> k;
  for (int i = 1; i <= k; i++) cin >> A[i];
  sort(A + 1, A + k + 1);
  if (A[1] == 1) return cout << 0 << '\n', 0;
  cout << solve(k, n);
  return 0;
}
