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