#include <bits/stdc++.h>
using namespace std;
using namespace std;
const int MaxL = 300005, MaxN = 102, NA = -1, MaxC = 0x3F3F3F3F;
int a[MaxN];
long long n, res;
int k;
int f[MaxN][MaxL];
long long recur(int p, long long v) {
  if (v < MaxL) {
    return f[p][v];
  } else {
    long long res;
    res = v;
    int i;
    long long temp;
    for (i = p; i < k; i++)
      if ((temp = v / a[i]) > 0)
        res -= recur(i + 1, temp);
      else
        break;
    return res;
  }
}
int main(void) {
  int i, l;
  while (scanf(" "
               "%lld"
               " %d",
               &n, &k) != EOF) {
    for (i = 0; i < k; i++) scanf(" %d", &a[i]);
    sort(a, a + k);
    memset(f, NA, sizeof(f));
    for (i = k; i >= 0; i--)
      for (l = 0; l < MaxL; l++) {
        if (l == 0)
          f[i][l] = 0;
        else if (i == k)
          f[i][l] = l;
        else
          f[i][l] = f[i + 1][l] - f[i + 1][l / a[i]];
      }
    printf(
        "%lld"
        "\n",
        recur(0, n));
  }
  return 0;
}
