#include <bits/stdc++.h>
using namespace std;
const double pi = 3.1415926535;
const double eps = 1e-6;
long long ans = 1, A[110], f[110][120010];
long long n, m;
long long dfs(int a, long long limit) {
  if (limit == 0) return 0;
  if (limit <= 120000 && f[a][limit] != -1) return f[a][limit];
  if (a == m) {
    if (limit <= 120000) f[a][limit] = limit;
    return limit;
  }
  if (limit <= 120000) {
    f[a][limit] = dfs(a + 1, limit) - dfs(a + 1, limit / A[a]);
    return f[a][limit];
  }
  return dfs(a + 1, limit) - dfs(a + 1, limit / A[a]);
}
int main() {
  cin >> n >> m;
  for (int i = 0; i < m; i++) cin >> A[i];
  sort(A, A + m);
  reverse(A, A + m);
  memset(f, -1, sizeof(f));
  cout << dfs(0, n) << endl;
}
