n, k = map(int, input().split()) a = list(map(int, input().split())) se = set() for bits in range(1 << n): cnt = 0 s = 0 p = 1 for j in range(n): if bits & (1 << j): cnt += 1 p *= a[j] s += a[j] if cnt < k: continue se.add(s) se.add(p) print(len(se))