n,k,*d=$<.read.split.map &:to_i c=0 n.times{|i|d[i]==m=i+1||(c+=1;d[d.index m],d[i]=d[i],m)} puts c<=k&&1&(k^c)<1?:YES: :NO