#include <bits/stdc++.h>
using namespace std;
namespace star {
const int maxn = 2e5 + 10, maxm = 110;
int a[maxm], k;
long long n, f[maxm][maxn];
bool vis[maxm][maxn];
long long dfs(int x, long long sum) {
  if (x == k) return 0;
  if (sum < maxn and vis[x][sum]) return f[x][sum];
  long long u = sum / a[x], w = u + dfs(x + 1, sum) - dfs(x + 1, u);
  if (sum < maxn) return vis[x][sum] = true, f[x][sum] = w;
  return w;
}
inline void work() {
  scanf("%lld%d", &n, &k);
  for (int i = 0; i < k; i++) scanf("%d", &a[i]);
  sort(a, a + k, greater<int>());
  printf("%lld\n", n - dfs(0, n));
}
}  // namespace star
signed main() {
  star::work();
  return 0;
}
