N,K = map(int,input().split()) A = list(map(int,input().split())) ansSet = set() for b in range(2**N): bit = bin(b)[2:].zfill(N) if bit.count('1') < K: continue s,x = 0,1 for i in range(len(bit)): if bit[i] == '1': s += A[i] x *= A[i] ansSet.add(s) ansSet.add(x) ansList = list(ansSet) print(len(ansList))