def popcount(n): cnt = 0 while n: cnt += n & 1 n //= 2 return cnt N, K = map(int, input().split()) A = list(map(int, input().split())) SS = set() for i in range(1 << N): if popcount(i) < K: continue S = 0 P = 1 for j in range(N): if (i >> j) & 1: S += A[j] P *= A[j] SS.add(S) SS.add(P) print(len(SS))