#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
long long n; int m, a[24]; vector<long long> v;
vector<long long> unique(vector<long long> u) {
vector<long long> ret;
if(u.size() >= 1) ret.push_back(u[0]);
for(int i = 1; i < u.size(); i++) {
if(u[i - 1] != u[i]) ret.push_back(u[i]);
}
return ret;
}
int main() {
scanf("%lld%d", &n, &m);
for(int i = 0; i < m; i++) scanf("%d", &a[i]);
for(int i = 0; i < (1 << m); i++) {
long long res = 1;
for(int j = 0; j < m; j++) {
if(i & (1 << j)) {
res *= a[j];
if(res > n) break;
}
}
if(res <= n) v.push_back(res);
}
sort(v.begin(), v.end());
v = unique(v);
int ret = 0;
for(int i = 0; i < v.size(); i++) {
long long r = v[i];
for(int j = 0; j < m; j++) {
if(v[i] % a[j] == 0) v[i] /= a[j];
}
if(v[i] == 1) ret++;
}
printf("%d\n", ret);
}
I2luY2x1ZGUgPHZlY3Rvcj4KI2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8YWxnb3JpdGhtPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwpsb25nIGxvbmcgbjsgaW50IG0sIGFbMjRdOyB2ZWN0b3I8bG9uZyBsb25nPiB2Owp2ZWN0b3I8bG9uZyBsb25nPiB1bmlxdWUodmVjdG9yPGxvbmcgbG9uZz4gdSkgewoJdmVjdG9yPGxvbmcgbG9uZz4gcmV0OwoJaWYodS5zaXplKCkgPj0gMSkgcmV0LnB1c2hfYmFjayh1WzBdKTsKCWZvcihpbnQgaSA9IDE7IGkgPCB1LnNpemUoKTsgaSsrKSB7CgkJaWYodVtpIC0gMV0gIT0gdVtpXSkgcmV0LnB1c2hfYmFjayh1W2ldKTsKCX0KCXJldHVybiByZXQ7Cn0KaW50IG1haW4oKSB7CglzY2FuZigiJWxsZCVkIiwgJm4sICZtKTsKCWZvcihpbnQgaSA9IDA7IGkgPCBtOyBpKyspIHNjYW5mKCIlZCIsICZhW2ldKTsKCWZvcihpbnQgaSA9IDA7IGkgPCAoMSA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