#include <bits/stdc++.h>
using namespace std;
int i, j, k, m;
int a[100010];
long long f[110][100010], n;
long long dfs(int n, long long m) {
  if (!n) return m;
  if (m < 100010 && f[n][m] >= 0) return f[n][m];
  long long A = dfs(n - 1, m) - dfs(n - 1, m / a[n]);
  if (m < 100010) f[n][m] = A;
  return A;
}
int main() {
  scanf("%I64d%d", &n, &m);
  for (i = 1; i <= m; i++) scanf("%d", &a[i]);
  sort(a + 1, a + m + 1);
  memset(f, 255, sizeof(f));
  printf("%I64d\n", dfs(m, n));
  return 0;
}
