from itertools import combinations n, k = map(int, input().split()) A = list(map(int, input().split())) ans = set() for i in range(k, n+1): for P in combinations(A, i): x = 0 y = 1 for p in P: x += p y *= p ans.add(x) ans.add(y) print(len(ans))