nk=list(input().split())
n=int(nk[0])
k=int(nk[1])
num=[int(c)for c inlist(input().split())]
m=[0]*(n+1)
index=[]for i inrange(n):if num[i]==0: index.append(i)else: m[num[i]]=1
a=[]for i inrange(1,n+1):if m[i]==0: a.append(i)defcal(num):
count=0for i inrange(n-1):for j inrange(i+1,n):if num[i]<num[j]: count+=1return count
defpermute(a):
res=[]defdfs(nums,tmp):iflen(nums)==len(tmp):
res.append(tmp[:])for m in nums:if m in tmp:continue
tmp.append(m)
dfs(nums,tmp)
tmp.remove(m)
dfs(a,[])return res
res=permute(a)
cnt=0for list1 in res:
count=0for i inrange(len(a)):
num[index[i]]=list1[i]if k==cal(num): cnt+=1print(cnt)