# -*- coding: utf-8 -*- ''' 行列式を思い出せる問題 http://mathtrain.jp/permutation O(N)の置換の実装がすべて(行きがかりのiをしかるべきものに交換してやらないといけない) ''' N,K = map(int, input().split()) D = list(map(int, input().split())) E = [0] for d in D: E.append(d) total = 0 for i in range(1, N+1): while E[i] != i: temp = E[i] E[i] = E[temp] E[temp] = temp total += 1 if total<=K and (K-total)%2==0: print('YES') else: print('NO')