#include <bits/stdc++.h>
using namespace std;
int countbit(int n) { return (n == 0) ? 0 : (1 + countbit(n & (n - 1))); }
int lowbit(int n) { return (n ^ (n - 1)) & n; }
const double pi = acos(-1.0);
const double eps = 1e-11;
template <class T>
T sqr(T x) {
  return x * x;
}
template <class T>
void checkmin(T &a, T b) {
  if (b < a) a = b;
}
template <class T>
void checkmax(T &a, T b) {
  if (b > a) a = b;
}
const int maxn = 100 + 5;
int n;
long long s;
int a[maxn];
int f[maxn][500000];
long long solve(int d, long long s) {
  if (s == 0 || d == n) return s;
  if (s < 500000 && f[d][s] != -1) return f[d][s];
  long long R = solve(d + 1, s) - solve(d + 1, s / a[d]);
  if (s < 500000) f[d][s] = (int)R;
  return R;
}
long long solve() {
  for (int i = 0; i < n; i++)
    if (a[i] <= 1) return 0;
  memset(f, 255, sizeof(f));
  return solve(0, s);
}
int main() {
  cin >> s >> n;
  for (int i = 0; i < n; i++) cin >> a[i];
  sort(a, a + n);
  reverse(a, a + n);
  long long ret = solve();
  cout << ret << endl;
  return 0;
}
