#include <bits/stdc++.h>
using namespace std;
const double pi = 2 * acos(0.0);
long long n, uns, dp[101][50001], m;
int a[101], i, k;
long long run(long long ss, int k) {
  if (k == 0) return ss;
  if (ss <= m && dp[k][ss] >= 0) return dp[k][ss];
  long long v = run(ss, k - 1) - run(ss / a[k], k - 1);
  if (ss <= m) dp[k][ss] = v;
  return v;
}
int main() {
  cin >> n >> k;
  for (i = 1; i <= k; i++) cin >> a[i];
  sort(a + 1, a + k + 1);
  memset(dp, -1, sizeof(dp));
  m = 5000;
  long long uns = run(n, k);
  cout << uns << endl;
  return 0;
}
