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