#include <bits/stdc++.h>
using namespace std;
const int MAXM = 111;
const int MAXN = 51111;
long long n, dp[MAXM][MAXN];
int m, a[MAXM];
long long dfs(int dep, long long val) {
  if (val == 0 || dep == 0) return val;
  if (val < MAXN && dp[dep][val] != -1) return dp[dep][val];
  long long ret = dfs(dep - 1, val) - dfs(dep - 1, val / a[dep]);
  if (val < MAXN) dp[dep][val] = ret;
  return ret;
}
int main() {
  ios::sync_with_stdio(false);
  cin >> n >> m;
  for (int i = 1; i <= m; ++i) cin >> a[i];
  sort(a + 1, a + m + 1);
  memset(dp, 255, sizeof dp);
  cout << dfs(m, n) << endl;
}
