d=lambda:map(int,input().split());a,b=d();c=list(d()) for i in range(a): f=c[i] while f!=i+1:b-=1;c[f-1],c[i]=c[i],c[f-1] else:print("NO"if b%2or b<0else"YES")