#include <bits/stdc++.h>
using namespace std;
const int threshold = 5000000;
long long cached[threshold];
long long solve(long long n, vector<int> &a, int pointer) {
  if (pointer < 0 || n == 0) {
    return n;
  }
  const long long id = 101 * n + pointer;
  if (id < threshold && ~cached[id]) {
    return cached[id];
  }
  const long long res =
      solve(n, a, pointer - 1) - solve(n / a[pointer], a, pointer - 1);
  if (id < threshold) {
    cached[id] = res;
  }
  return res;
}
int main() {
  long long n;
  cin >> n;
  int k;
  cin >> k;
  vector<int> a(k);
  for (int i = 0; i < k; i++) {
    cin >> a[i];
  }
  sort(a.begin(), a.end());
  memset(cached, -1, sizeof(cached));
  cout << solve(n, a, k - 1) << "\n";
  return 0;
}
