#include <bits/stdc++.h>
using namespace std;
int a[101];
long long d[100][10001];
long long get(long long n, int k) {
  if (k == -1) return n;
  if (k == 0) return n - n / (long long)a[0];
  if (n <= 10000) {
    if (d[k][n] != -1)
      return d[k][n];
    else
      return d[k][n] = get(n, k - 1) - get(n / a[k], k - 1);
  }
  return get(n, k - 1) - get(n / a[k], k - 1);
}
int main() {
  int k;
  long long n;
  cin >> n >> k;
  for (int i = 0; i < k; ++i) cin >> a[i];
  for (int i = 0; i < k; ++i)
    for (int j = 0; j <= 10000; ++j) d[i][j] = -1;
  sort(a, a + k);
  cout << get(n, k - 1);
  return 0;
}
