#include <bits/stdc++.h>
using namespace std;
long long n, k, g, ans;
long long a[105];
long long Map[102][300005];
long long goes(long long n, long long k) {
  if (k == 0) return n;
  if (n > 300000) return goes(n, k - 1) - goes(n / a[k - 1], k - 1);
  if (Map[k][n] == -1) Map[k][n] = goes(n, k - 1) - goes(n / a[k - 1], k - 1);
  return Map[k][n];
}
int main() {
  cin >> n >> k;
  for (int i = 0; i < k; ++i) cin >> a[i];
  sort(a, a + k);
  memset(Map, -1, sizeof(Map));
  cout << goes(n, k) << endl;
}
