#include <bits/stdc++.h>
using namespace std;
static const double EPS = 1e-9;
static const double PI = acos(-1.0);
int as[110];
long long memo[100][50000];
long long calc(long long n, int pos) {
  if (n < 50000 && memo[pos][n] != -1) {
    return memo[pos][n];
  }
  long long v = n / as[pos];
  long long ret = v;
  if (pos != 0) {
    if (v >= as[0]) {
      ret -= calc(v, pos - 1);
    }
    ret += calc(n, pos - 1);
  }
  if (n < 50000) {
    memo[pos][n] = ret;
  }
  return ret;
}
int main() {
  long long n, k;
  while (cin >> n >> k) {
    memset((memo), -1, sizeof(memo));
    for (int i = 0; i < (int)(k); i++) {
      cin >> as[i];
    }
    sort(as, as + k);
    cout << n - calc(n, k - 1) << endl;
  }
}
