#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:65777216")
using namespace std;
long long n, res = 0, val;
int k, nums[104];
pair<long long, long long> v[2][3000000], v1[3000000];
int vsz[2], v1sz;
int main() {
  cin >> n >> k;
  for (int i = 0; i < k; i++) cin >> nums[i];
  v[0][vsz[0]++] = make_pair(n, 1);
  int curv = 0;
  for (int i = 0; i < k; i++) {
    v1sz = 0;
    for (int j = 0; j < vsz[curv]; j++)
      if (v[curv][j].first >= nums[i]) {
        long long val = v[curv][j].first / nums[i];
        if (v1sz > 0 && v1[v1sz - 1].first == val)
          v1[v1sz - 1].second -= v[curv][j].second;
        else
          v1[v1sz++] =
              make_pair(v[curv][j].first / nums[i], -v[curv][j].second);
      }
    vsz[curv ^ 1] = 0;
    int f1 = 0, f2 = 0;
    while (f1 < vsz[curv] || f2 < v1sz) {
      if (f1 == vsz[curv])
        v[curv ^ 1][vsz[curv ^ 1]++] = v1[f2++];
      else if (f2 == v1sz)
        v[curv ^ 1][vsz[curv ^ 1]++] = v[curv][f1++];
      else {
        if (v[curv][f1].first > v1[f2].first)
          v[curv ^ 1][vsz[curv ^ 1]++] = v[curv][f1++];
        else if (v[curv][f1].first < v1[f2].first)
          v[curv ^ 1][vsz[curv ^ 1]++] = v1[f2++];
        else {
          v[curv ^ 1][vsz[curv ^ 1]++] =
              make_pair(v[curv][f1].first, v[curv][f1].second + v1[f2].second);
          f1++;
          f2++;
        }
      }
    }
    curv ^= 1;
  }
  long long res = 0;
  for (int i = 0; i < vsz[curv]; i++)
    res += v[curv][i].first * v[curv][i].second;
  cout << res << endl;
  return 0;
}
