#include <bits/stdc++.h>
using namespace std;
const int MAXK = 100 + 10;
const int MAXW = 10000 + 10;
int k;
int a[MAXK];
long long n;
long long dp[MAXK][MAXW][2];
long long IE(const int &pos, const long long &val, const int &sgn) {
  if (val == 0) return 0;
  if (pos == k + 1) return sgn * val;
  if (val >= MAXW)
    return IE(pos + 1, val, sgn) + IE(pos + 1, val / a[pos], -sgn);
  long long &ret = dp[pos][val][sgn == 1];
  if (ret != -1) return ret;
  return ret = IE(pos + 1, val, sgn) + IE(pos + 1, val / a[pos], -sgn);
}
int main() {
  cin >> n >> k;
  for (int i = 1; i <= k; i++) cin >> a[i];
  sort(a + 1, a + k + 1, greater<int>());
  if (a[k] == 1) {
    cout << 0 << endl;
    return 0;
  }
  memset(dp, -1, sizeof dp);
  cout << IE(1, n, 1) << endl;
  return 0;
}
