#include <bits/stdc++.h>
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
const int N = 2e5 + 10;
const long long mod = 1e9 + 7;
const long long mod2 = 998244353;
const long long inf = 8e18;
const int LOG = 22;
long long pw(long long a, long long b, long long M) {
  return (!b ? 1
             : (b & 1 ? (a * pw(a * a % M, b / 2, M)) % M
                      : pw(a * a % M, b / 2, M)));
}
int A[N];
int dp[102][N];
long long calc(int n, long long x) {
  if (x < N && dp[n][x] != -1) return dp[n][x];
  if (!n || x <= 1) return x;
  long long cu = calc(n - 1, x) - calc(n - 1, x / A[n]);
  if (x < N) dp[n][x] = cu;
  return cu;
}
int main() {
  memset(dp, -1, sizeof dp);
  long long x, n;
  scanf("%lld%lld", &x, &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &A[i]);
    if (A[i] == 1) {
      return !printf("0");
    }
  }
  sort(A + 1, A + n + 1);
  printf("%lld", calc(n, x));
  return 0;
}
