#include <bits/stdc++.h>
using namespace std;
const int U = 80;
const int L = 20000;
long long n;
int m, a[111];
int F[U][L];
int f0(int n, int i) {
  if (n == 0 || i < 0) return n;
  int &res = F[i][n];
  if (res < 0) {
    res = n;
    for (; i >= 0; --i) res -= f0(n / a[i], i - 1);
  }
  return res;
}
long long f(long long n, int i) {
  if (n == 0) return 0;
  if (i < U && n < L) return f0(n, i);
  long long res = n;
  for (; i >= 0; --i) res -= f(n / a[i], i - 1);
  return res;
}
int main() {
  memset(F, -1, sizeof F);
  cin >> n >> m;
  for (int i(0); i < m; ++i) cin >> a[i];
  sort(a, a + m);
  cout << f(n, m - 1) << endl;
  return 0;
}
