N, K = map(int, input().strip().split()) ai = [int(i) for i in input().split()] ans = set() for bits in range(1 << N): if bin(bits).count("1") >= K: sum = 0 mul = 1 for k in range(N): if bits & (1 << k): sum += ai[k] mul *= ai[k] ans.add(sum) ans.add(mul) print(len(ans))