def popcount(x): x -= (x >> 1) & 0x55555555 x = (x & 0x33333333) + ((x >> 2) & 0x33333333) x = (x + (x >> 4)) & 0x0f0f0f0f x += x >> 8 x += x >> 16 return x & 0x3f N, K = map(int, input().split()) A = [int(a) for a in input().split()] S = set() for i in range(1 << N): if popcount(i) < K: continue s = 0 t = 1 for j, a in enumerate(A): if i >> j & 1: s += a t *= a S.add(s) S.add(t) print(len(S))