#include <bits/stdc++.h> using namespace std; #include <atcoder/all> using namespace atcoder; //using mint = modint1000000007; using mint = modint998244353; template <typename T> bool chmax(T &u, const T z) { if (u < z) {u = z; return true;} else return false; } template <typename T> bool chmin(T &u, const T z) { if (u > z) {u = z; return true;} else return false; } #define ll long long #define rep(i, n) for (ll i = 0; i < (ll)(n); i++) typedef pair<ll, int> P; ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; } ll lcm(ll a, ll b){return a * b / gcd(a, b);} int main(){ int n,k; cin>>n>>k; vector<ll>a(n); rep(i,n)cin>>a[i]; map<ll,int>mp; rep(i,(1<<n)){ int bit[20]; rep(j,n){ bit[j]=(i/(1<<j))%2; } ll tmp=0; ll tmp_kakeru=1; int cnt=0; rep(j,n){ if(bit[j]){ tmp+=a[j]; tmp_kakeru*=a[j]; cnt++; } } if(cnt>=k)mp[tmp]++; if(cnt>=k)mp[tmp_kakeru]++; } ll ans=mp.size(); cout<<ans<<endl; return 0; }