#include <bits/stdc++.h>
using namespace std;
int M[110][500100];
vector<int> v;
long long f(int k, long long n) {
  if (n < 500000 && M[k][n] != -1) return M[k][n];
  if (k == 0) {
    if (n < 500000) M[k][n] = n;
    return n;
  }
  long long tmp = f(k - 1, n) - f(k - 1, n / v[k - 1]);
  if (n < 500000) M[k][n] = tmp;
  return tmp;
}
int main() {
  long long n;
  int k;
  cin >> n >> k;
  memset(M, -1, sizeof(M));
  v.resize(k);
  for (int i = (0); i < (k); ++i) cin >> v[i];
  sort((v).begin(), (v).end());
  long long ans = f(k, n);
  cout << ans << endl;
  return 0;
}
