n,k=map(int,input().split()) d=list(map(int,input().split())) y=[0]*n for i in range(n): d[i]-=1 y[d[i]]=i for i in range(n): if d[i]!=i: p1,p2=i,y[i] d[p1],d[p2]=d[p2],d[p1] y[d[p1]],y[d[p2]]=y[d[p2]],y[d[p1]] k-=1 print(["NO","YES"][k%2==0])