#include <bits/stdc++.h>
using namespace std;
long long n;
int k;
int a[105];
long long brut(long long p, int i) {
  if (i == k || a[i] > p) return p;
  return brut(p, i + 1) - brut(p / a[i], i + 1);
}
int main() {
  ios::sync_with_stdio(!cin.tie(0));
  cin >> n >> k;
  for (int i = 0; i < k; i++) cin >> a[i];
  if (count(a, a + k, 1)) {
    cout << "0\n";
    return 0;
  }
  sort(a, a + k, greater<int>());
  vector<pair<long long, int>> vec = {{n, 1}};
  for (int i = 0; i < k; i++) {
    vector<pair<long long, int>> tmp, mrg;
    for (auto [p, v] : vec) {
      if (p >= a[i]) {
        long long p2 = p / a[i];
        tmp.emplace_back(p2, -v);
      }
    }
    int j = 0;
    for (auto [p, v] : vec) {
      while (j < (int)tmp.size() && tmp[j].first <= p) mrg.push_back(tmp[j++]);
      if (mrg.size() && mrg.back().first == p)
        mrg.back().second += v;
      else
        mrg.emplace_back(p, v);
    }
    swap(vec, mrg);
  }
  long long sol = 0;
  for (auto [p, v] : vec) sol += p * v;
  cout << sol << '\n';
}
