N, K = map(int, input().split()) A = list(map(int, input().split())) # print(A) st = set() for mask in range(1, 1 << N): su = 0 pi = 1 # print("mask " + str(mask)) cnt = 0 for i in range(N): if mask >> i & 1: su += A[i] pi *= A[i] cnt += 1 # print(i, end = ' ') # print() if cnt >= K: st.add(su) st.add(pi) # print(st) print(len(st))