#include <bits/stdc++.h>
using namespace std;
long long dp[100005][105];
int arr[105];
long long f(long long n, int m) {
  if (m < 0) return n;
  long long ans;
  if (n < 100005 && dp[n][m] != -1) return dp[n][m];
  ans = f(n, m - 1) - f(n / arr[m], m - 1);
  if (n < 100005) dp[n][m] = ans;
  return ans;
}
int main() {
  long long n;
  int m;
  memset(dp, -1, sizeof(dp));
  cin >> n >> m;
  for (int i = 0; i < m; i++) scanf("%d", &arr[i]);
  sort(arr, arr + m);
  cout << f(n, m - 1) << "\n";
}
