#include <bits/stdc++.h>
using namespace std;
template <class T>
inline void read(T& x) {
  bool fu = 0;
  char c;
  for (c = getchar(); c <= 32; c = getchar())
    ;
  if (c == '-') fu = 1, c = getchar();
  for (x = 0; c > 32; c = getchar()) x = x * 10 + c - '0';
  if (fu) x = -x;
};
template <class T>
inline void read(T& x, T& y) {
  read(x);
  read(y);
}
template <class T>
inline void read(T& x, T& y, T& z) {
  read(x);
  read(y);
  read(z);
}
inline char getc() {
  char c;
  for (c = getchar(); c <= 32; c = getchar())
    ;
  return c;
}
const int D = 50000;
long long n, ans;
int i, j, k, l, p, a[101], m;
long long f[101][D + 1];
bool v[101][D + 1];
long long dfs(int dep, long long n) {
  if (dep > m) return n;
  if (n <= D) {
    if (v[dep][n]) return f[dep][n];
    v[dep][n] = 1;
  }
  long long ans = dfs(dep + 1, n) - dfs(dep + 1, n / a[dep]);
  if (n <= D) f[dep][n] = ans;
  return ans;
}
int main() {
  read(n);
  read(m);
  for (i = 1; i <= m; i++) read(a[i]);
  sort(a + 1, a + 1 + m, greater<int>());
  cout << dfs(1, n) << endl;
  scanf("\n");
  return 0;
}
