from itertools import combinations n, k = map(int, input().split()) A = list(map(int, input().split())) ANS = set() for r in range(k, n + 1): for C in combinations(range(n), r): add_temp = 0 product_temp = 1 for idx in C: add_temp += A[idx] product_temp *= A[idx] ANS.add(add_temp) ANS.add(product_temp) print(len(ANS))