#include using namespace std; const int INF = 0x3f3f3f3f; typedef long long LL; const int N = 20; int a[N]; int n, m; int res; int main() { scanf("%d %d", &n, &m); for (int i = 0; i < m; i++) scanf("%d", &a[i]); for (int i = 1; i < 1 << m; i++) { int s = 1, c = 0; for (int j = 0; j < m; j++) if (i >> j & 1) { if ((LL)s * a[j] > n) { s = 0; break; } s *= a[j]; c++; } if (s) { if (c & 1) res += n / s; else res -= n / s; } } printf("%d\n", res); return 0; }