n,k = map(int,input().split()) a = [int(i) for i in input().split()] num = 2**n ans = set() for i in range(num): tmp = format(i, '0'+str(n)+'b') sm = 0 sk = 1 cnt = 0 for j in range(n): if tmp[j] == "1": sm += a[j] sk *= a[j] cnt += 1 if cnt >= k: ans.add(sm) ans.add(sk) print(len(ans))