typedef long long ll; typedef long double ld; #include using namespace std; #define int long long struct Eratos { vector primes; vector isprime; vector mebius; vector min_factor; Eratos(int MAX) : primes(), isprime(MAX+1, true), mebius(MAX+1, 1), min_factor(MAX+1, -1) { isprime[0] = isprime[1] = false; min_factor[0] = 0, min_factor[1] = 1; for (int i = 2; i <= MAX; ++i) { if (!isprime[i]) continue; primes.push_back(i); mebius[i] = -1; min_factor[i] = i; for (int j = i*2; j <= MAX; j += i) { isprime[j] = false; if ((j / i) % i == 0) mebius[j] = 0; else mebius[j] = -mebius[j]; if (min_factor[j] == -1) min_factor[j] = i; } } } // prime factorization vector> prime_factors(int n) { vector > res; while (n != 1) { int prime = min_factor[n]; int exp = 0; while (min_factor[n] == prime) { ++exp; n /= prime; } res.push_back(make_pair(prime, exp)); } return res; } // enumerate divisors vector divisors(int n) { vector res({1}); auto pf = prime_factors(n); for (auto p : pf) { int n = (int)res.size(); for (int i = 0; i < n; ++i) { int v = 1; for (int j = 0; j < p.second; ++j) { v *= p.first; res.push_back(res[i] * v); } } } return res; } }; const int MAX = 210000; signed main(){ Eratos er(MAX); vector> divs(MAX); for (int n = 1; n < MAX; ++n) divs[n] = er.divisors(n); ll n,m; std::cin >> n>>m; vector idea(n+1),real(n+1); for (int i = 1; i <= n; i++) { for (auto e : divs[i]) { idea[e] = !idea[e]; } } for (int i = 0; i < m; i++) { ll a; std::cin >> a; real[a]=true; } ll cnt = 0; for (int i = n; i >= 1; i--) { if(idea[i]!=real[i]){ cnt++; for (auto e : divs[i]) { real[e] = !real[e]; } } } std::cout << cnt << std::endl; }