N,K = map(int,input().split()) D = list(map(int,input().split())) count = 0 i = 0 while i < N: if D[i] != i + 1: j = D[i] D[i],D[j-1] = D[j-1],D[i] count += 1 else: i += 1 if count <= K and (K-count)%2 == 0: print('YES') else: print('NO')