import bisect def popcount(x): x = x - ((x >> 1) & 0x55555555) # 4bit整数に 上位2bit + 下位2bit を計算した値を入れる x = (x & 0x33333333) + ((x >> 2) & 0x33333333) x = (x + (x >> 4)) & 0x0f0f0f0f # 8bitごと x = x + (x >> 8) # 16bitごと x = x + (x >> 16) # 32bitごと return x & 0x0000007f N, K = map(int, input().split()) A = list(map(int, input().split())) ans = [] for a in range(1, 1 << N): if popcount(a) >= K: s , p = 0, 1 for i in range(N): if ((a >> i) & 1): s += A[i] p *= A[i] j = bisect.bisect_left(ans, s) if j == len(ans) or ans[j] != s: ans.insert(j, s) j = bisect.bisect_left(ans, p) if j == len(ans) or ans[j] != p: ans.insert(j, p) print(len(ans))