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