from itertools import permutations n,k = map(int,input().split()) a = list(map(int,input().split())) lis = [i for i in range(n)] ans = 0 for i in permutations(lis,k): fl = False for j in range(k-1): if i[j] > i[j+1]: fl = True if fl: continue tmp = 0 for j in range(k): tmp += a[i[j]] if tmp < 998: ans += 1 print(ans%998)