import sys sys.setrecursionlimit(10 ** 6) stdin = sys.stdin ni = lambda: int(ns()) na = lambda: list(map(int, stdin.readline().split())) ns = lambda: stdin.readline().strip() ntp = lambda: tuple(map(int, stdin.readline().split())) mod = 10 * 9 + 7 inf = 2 << 60 n, k = na() A = na() Ans = set() for i in range(1 << n): sum = 0 time = 1 cnt = 0 for j in range(n): if i & 1 << j: sum += A[j] time *= A[j] cnt += 1 if cnt >= k: Ans.add(sum) Ans.add(time) print(len(Ans))