#include #include #include using namespace std; typedef pair P; std::vector enum_prime(int n){ // containing n std::vector res; if (n <= 1) return res; std::vector p(n + 1); fill(p.begin() + 2, p.end(), true); for(int i = 2; i <= n; i++){ if(p[i]){ res.push_back(i); for(int j = i * 2; j <= n; j += i) p[j] = false; } } return res; } int main() { int n, k; cin >> n >> k; vector prime = enum_prime(1000); int a[20]; vector

v[20]; for(int i = 0; i < n; i++){ cin >> a[i]; int b = a[i]; for(int p : prime){ if(b % p == 0){ int c = 0; while(b % p == 0){ c++; b /= p; } v[i].push_back(P(p, c)); } } } set st; for(int b = 0; b < (1 << n); b++){ int e = 0; int s = 1; int t = 0; for(int i = 0; i < n; i++){ if(!((b >> i) & 1)) continue; e++; for(P p : v[i]){ for(int j = 0; j < p.second; j++) s *= p.first; } t += a[i]; } if(e >= k){ st.insert(s); st.insert(t); } } cout << (int)st.size() << endl; }