#include <bits/stdc++.h>
using namespace std;
long long int dp[6000000], n;
int k;
long long int a[100];
int s;
long long int clac(long long int n, int t_k) {
  if (t_k == -1) return n;
  if (n == 0) return 0;
  if (n < s) {
    if (dp[t_k * s + n] != -1) return dp[t_k * s + n];
    dp[t_k * s + n] = clac(n, t_k - 1) - clac(n / a[t_k], t_k - 1);
    return dp[t_k * s + n];
  }
  return clac(n, t_k - 1) - clac(n / a[t_k], t_k - 1);
}
int main() {
  cin >> n >> k;
  if (k != 0) s = 6000000 / k;
  memset(dp, -1, sizeof(dp));
  for (int i = 0; i < k; i++) cin >> a[i];
  sort(a, a + k);
  cout << clac(n, k - 1) << endl;
}
