#include <bits/stdc++.h>
using namespace std;
long long int k;
long long int a[2000];
const int limite = 250000;
long long int memcalcula[limite][100];
char calculado[limite][100];
long long int calcula(long long int n, int i) {
  if (n <= 1) return 0;
  if (i >= k) return 0;
  if (n < limite and calculado[n][i]) return memcalcula[n][i];
  long long int d = n / a[i];
  long long int sol = d - calcula(d, i + 1) + calcula(n, i + 1);
  if (n < limite and not calculado[n][i]) {
    memcalcula[n][i] = sol;
    calculado[n][i] = 1;
  }
  return sol;
}
int main() {
  long long int n;
  cin >> n >> k;
  bool hay1 = false;
  for (int i = 0; i < k; i++) {
    cin >> a[i];
    hay1 = hay1 or a[i] == 1;
  }
  if (hay1) {
    cout << 0 << endl;
    exit(0);
  }
  sort(a, a + k);
  reverse(a, a + k);
  cout << n - calcula(n, 0) << endl;
}
