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