from itertools import product from operator import mul from functools import reduce N, K = map(int, input().split()) A = [int(x) for x in input().split()] s = set() for p in product([0, 1], repeat=N): if list(p).count(1) < K: continue s.add(sum(A[i] for i in range(N) if p[i])) # s.add(reduce((lambda x, y: x * y), (A[i] for i in range(N) if p[i]))) s.add(reduce(mul, (A[i] for i in range(N) if p[i]))) print(len(s)) z = lambda x, y: x * y