#include <bits/stdc++.h>
using namespace std;
long long dp[105][300000];
long long n, m;
long long a[105];
long long recur(long long pos, long long rem) {
  if (rem == 0) return rem;
  if (pos == m) return rem;
  if (300000 <= rem) return recur(pos + 1, rem) - recur(pos + 1, rem / a[pos]);
  long long &res = dp[pos][rem];
  if (res != -1) return res;
  return res = recur(pos + 1, rem) - recur(pos + 1, rem / a[pos]);
}
int main() {
  for (long long i = 0; i < ((long long)105); i++)
    for (long long j = 0; j < ((long long)300000); j++) dp[i][j] = -1;
  cin >> n >> m;
  for (long long i = 0; i < ((long long)m); i++) cin >> a[i];
  sort(a, a + m);
  reverse(a, a + m);
  cout << recur(0, n) << endl;
}
