#include using namespace std; #define FOR(i,a,b) for(int i=(a);i<(b);++i) #define REP(i,n) FOR(i,0,n) #define ALL(v) begin(v),end(v) template inline bool chmax(A & a, const B & b) { if (a < b) { a = b; return true; } return false; } template inline bool chmin(A & a, const B & b) { if (a > b) { a = b; return true; } return false; } using ll = long long; using pii = pair; constexpr ll INF = 1ll<<30; constexpr ll longINF = 1ll<<60; constexpr ll MOD = 1000000007; constexpr bool debug = false; //---------------------------------// std::vector> prime_factorization(ll n) { std::vector> res; for (int i = 2; i * i <= n; i++) { if (n % i == 0) res.emplace_back(i, 1), n /= i; while (n % i == 0) ++res.back().second, n /= i; } if (n > 1) res.emplace_back(n, 1); return res; } int main() { int N, K; cin >> N >> K; vector A(N); vector> vec(N); REP(i, N) { scanf("%d", &A[i]); vec[i] = prime_factorization(A[i]); } struct Vec { vector val; Vec (const vector & v) : val(v) {} int size() const noexcept { return val.size(); } pii & operator[](int k) { return val[k]; } pii operator[](int k) const { return val[k]; } bool operator <(const Vec & rhs) const { if (size() != rhs.size()) return size() < rhs.size(); REP(i, size()) if (val[i] != rhs[i]) return val[i] < rhs[i]; return true; } }; set ss; REP(i, 1 << N) { auto func = [&](auto v1, auto v2) { vector res; int p1 = 0, p2 = 0; while (p1 < v1.size() || p2 < v2.size()) { if (p1 < v1.size() && p2 < v2.size()) { if (v1[p1].first == v2[p2].first) { res.emplace_back(v1[p1].first, v1[p1].second + v2[p2].second); ++p1; ++p2; } else if (v1[p1].first < v2[p2].first) res.emplace_back(v1[p1++]); else res.emplace_back(v2[p2++]); } else if (p1 < v1.size()) res.emplace_back(v1[p1++]); else res.emplace_back(v2[p2++]); } return res; }; int p = 0, sum = 0; vector v; REP(j, N) if (i >> j & 1) { ++p; sum += A[j]; v = func(v, vec[j]); } if (p < K) continue; ss.insert(prime_factorization(sum)); ss.insert(v); } int ans = 0; vector prv; for (auto v : ss) { ans += prv != v.val; prv = v.val; } cout << ans << endl; }