n, k = [int(i) for i in input().split()] num = [int(i) for i in input().split()] ans = set([]) for i in range(1 << n): s = 0 p = 1 c = 0 for j in range(n): if (i >> j) & 1: s += num[j] p *= num[j] c += 1 if c >= k: ans.add(p) ans.add(s) print(len(ans))