#include <bits/stdc++.h>
using namespace std;
template <class T>
int size(const T &a) {
  return int(a.size());
}
template <class T>
T sqr(const T &a) {
  return a * a;
}
int a[200], n;
long long m;
const int max_n = 150000;
long long dp[101][max_n];
long long calc(int i, long long cur) {
  if (cur < max_n && dp[i][cur] != -1) {
    return dp[i][cur];
  }
  if (i == n) {
    if (cur < max_n) {
      dp[i][cur] = cur;
    }
    return cur;
  }
  long long v = calc(i + 1, cur);
  if (cur >= a[i]) {
    v -= calc(i + 1, cur / a[i]);
  }
  if (cur < max_n) {
    dp[i][cur] = v;
  }
  return v;
}
int main() {
  memset(dp, -1, sizeof(dp));
  cin >> m >> n;
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
    if (a[i] == 1) {
      cout << 0 << endl;
      return 0;
    }
  }
  sort(a, a + n);
  reverse(a, a + n);
  cout << calc(0, m) << endl;
  return 0;
}
