#include <bits/stdc++.h>
using namespace std;
long long int dp[200001 + 1][101], n, k, a[101];
long long int solve(long long int n, long long int ind) {
  if (ind == k + 1) return n;
  if (n == 0) return 0;
  long long int ans;
  if (n <= 200001) {
    ans = dp[n][ind];
    if (ans != -1) return ans;
  }
  ans = solve(n, ind + 1) - solve(n / a[ind], ind + 1);
  if (n <= 200001) dp[n][ind] = ans;
  return ans;
}
int main() {
  ios::sync_with_stdio(false);
  ;
  cin.tie(0);
  ;
  long long int i, j;
  cin >> n >> k;
  for (i = 1; i <= k; i++) cin >> a[i];
  for (i = 0; i <= 200001; i++) {
    for (j = 0; j <= k; j++) dp[i][j] = -1;
  }
  sort(a + 1, a + k + 1);
  reverse(a + 1, a + k + 1);
  cout << solve(n, 1);
  return 0;
}
