#include <bits/stdc++.h>
using namespace std;
inline int in() {
  int32_t x;
  scanf("%d", &x);
  return x;
}
inline long long lin() {
  long long x;
  scanf("%lld", &x);
  return x;
}
inline string get() {
  char ch[2000010];
  scanf("%s", ch);
  return ch;
}
inline void read(int *a, int n) {
  for (int i = 0; i < n; i++) a[i] = in();
}
template <class blank>
inline void out(blank x) {
  cout << x << "\n";
  exit(0);
}
const int maxn = 1e5 + 10;
const int maxm = 1e6 + 10;
const int maxlg = 21;
const int base = 29;
const int mod = 1e9 + 7;
const long long INF = 1e18 + 10;
const int SQ = 317 + 5;
long long n, k;
int a[maxn];
long long dp[101][100001];
inline long long calc(int pos, long long n) {
  if (pos >= k) return n;
  if (n < 100001 && dp[pos][n] + 1) return dp[pos][n];
  long long res = calc(pos + 1, n) - calc(pos + 1, n / a[pos]);
  if (n < 100001) dp[pos][n] = res;
  return res;
}
int32_t main() {
  cin >> n >> k;
  memset(dp, -1, sizeof dp);
  read(a, k);
  sort(a, a + k, greater<int>());
  cout << calc(0, n) << "\n";
}
