N,K=map(int,input().split()) D=[ x-1 for x in map(int,input().split())] Z=[int(D[i]==i) for i in range(N)].count(0) swaptime=(Z+1)//2 print(('YES','NO')[(K-swaptime)%2==1])