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