#include <bits/stdc++.h>
using namespace std;
const int N = 100, M = 200000;
long long n;
int m;
int a[N];
int f[N][M];
long long dfs(int k, long long n) {
  if (k >= m || n == 0) return n;
  if (n < M && f[k][n] != -1) return f[k][n];
  long long ret = dfs(k + 1, n) - dfs(k + 1, n / a[k]);
  if (n < M) f[k][n] = ret;
  return ret;
}
int main() {
  cin >> n >> m;
  for (int i = 0; i < m; ++i) scanf("%d", a + i);
  sort(a, a + m);
  reverse(a, a + m);
  memset(f, -1, sizeof(f));
  cout << dfs(0, n) << endl;
}
