#include <bits/stdc++.h>
using namespace std;
long long n, pa;
int m, i, j, k, p;
int a[100], b[1000000];
vector<int> c[100];
void rec(long long n, int ii, int t) {
  if (ii == m) {
    pa += n * t;
    return;
  }
  if (n < 1000000) {
    c[ii].push_back(n * t);
    return;
  }
  rec(n, ii + 1, t);
  rec(n / a[ii], ii + 1, -t);
}
int main() {
  scanf("%I64d %d", &n, &m);
  for (i = 0; i < m; i++) {
    scanf("%d", &a[i]);
    if (a[i] == 1) {
      printf("0");
      return 0;
    }
  }
  sort(a, a + m);
  rec(n, 0, 1);
  for (i = 0; i < m; i++) {
    for (j = i; j < m; j++)
      for (k = a[j]; k < 1000000; k += a[j]) b[k] = 1;
    for (j = 1; j < 1000000; j++) b[j] = b[j - 1] + 1 - b[j];
    for (j = 0; j < c[i].size(); j++)
      if (c[i][j] > 0)
        pa += b[c[i][j]];
      else
        pa -= b[-c[i][j]];
    for (j = 1; j < 1000000; j++) b[j] = 0;
  }
  printf("%I64d\n", pa);
  return 0;
}
