#include <bits/stdc++.h>
using namespace std;
const long double eps = 1e-7;
const int inf = (int)1e9;
const long long linf = (long long)1e18;
const long double pi = acos(-1.0);
const int prime = 748297;
inline void finclude() { srand(time(NULL)); }
long long a[101];
long long b[101][300000];
long long f(long long m, long long n) {
  if (m == -1) return n;
  if (n < 300000 && b[m][n] != -1) return b[m][n];
  if (a[m] == 0) {
    bool t = false;
  }
  long long res = f(m - 1, n) - f(m - 1, n / a[m]);
  if (n < 300000) b[m][n] = res;
  return res;
}
int main() {
  finclude();
  long long n, m;
  cin >> n >> m;
  for (int i = 0; i < 101; ++i)
    for (int j = 0; j < 300000; ++j) b[i][j] = -1;
  for (int i = 0; i < m; ++i) cin >> a[i];
  for (int i = 0; i < m; ++i)
    for (int j = i + 1; j < m; ++j)
      if (a[i] > a[j]) swap(a[i], a[j]);
  long long ans = f(m - 1, n);
  cout << ans << '\n';
}
