# -*- coding: utf-8 -*- N,K = map(int, input().split()) D = list(map(int, input().split())) total = 0 for i in range(N): if D[i] != i+1: # D[i]とD[D[i]-1]を交換 temp = D[i] D[i] = D[temp-1] D[temp-1] = temp total += 1 if total<=K and (K-total)%2==0: print('YES') else: print('NO')