#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100010;
int a[101];
long long n, k, dp[101][MAXN];
long long cal(int i, long long nn) {
  if (i == k) return nn;
  if (nn >= MAXN) return cal(i + 1, nn) - cal(i + 1, nn / a[i]);
  if (dp[i][nn] == -1) dp[i][nn] = cal(i + 1, nn) - cal(i + 1, nn / a[i]);
  return dp[i][nn];
}
int main() {
  while (cin >> n >> k) {
    for (int i = 0; i < k; ++i) {
      cin >> a[i];
      memset(dp[i], -1, sizeof(long long) * min((long long)MAXN, n + 1));
    }
    sort(a, a + k);
    reverse(a, a + k);
    cout << cal(0, n) << endl;
  }
  return 0;
}
