local bls, brs = bit.lshift, bit.rshift local mfl = math.floor local mod1, mod2, mod3 = 1000000007, 1000000009, 998244353 local function bmul(x, y, mod) local z1, z2 = 31623, 14122 if mod == 1000000009 then z2 = 14120 elseif mod == 998244353 then z1, z2 = 31596, 62863 end local x1, y1 = mfl(x / z1), mfl(y / z1) local x0, y0 = x - x1 * z1, y - y1 * z1 return (x1 * y1 * z2 + (x1 * y0 + x0 * y1) * z1 + x0 * y0) % mod end local function modpow(src, pow, mod) local res = 1 while 0 < pow do if pow % 2 == 1 then res = bmul(res, src, mod) pow = pow - 1 end src = bmul(src, src) pow = mfl(pow / 2) end return res end local function modinv(src, mod) return modpow(src, mod - 2, mod) end local n, k = io.read("*n", "*n") local a = {} for i = 1, n do a[i] = io.read("*n") end local t = {} local g = {} local tot = bls(1, n) for i = 0, tot - 1 do local sum = 0 local rawmul = 1 local m1, m2, m3 = 1, 1, 1 local ti = i local c = 0 for j = 1, n do if ti % 2 == 1 then c = c + 1 sum = sum + a[j] rawmul = rawmul * a[j] m1, m2, m3 = bmul(m1, a[j], mod1), bmul(m2, a[j], mod2), bmul(m3, a[j], mod3) end ti = brs(ti, 1) end if k <= c then t[sum] = true if rawmul < 20 * 1000 then t[rawmul] = true else if not g[m1] then g[m1] = {} end if not g[m1][m2] then g[m1][m2] = {} end g[m1][m2][m3] = true end end end local ret = 0 for _k, _v in pairs(t) do ret = ret + 1 end for _m1, t1 in pairs(g) do for _m2, t2 in pairs(t1) do for _m3, _t3 in pairs(t2) do ret = ret + 1 end end end print(ret)