n,k=gets.split.map{|e| e.to_i} x=gets.split.map{|e| e.to_i-1} hs={} i=0 n.times{|i| while x[i]!=i t=x[i] x[i]=x[t] x[t]=t k-=1 end } if k<0 puts "NO" elsif k%2==0 puts "YES" else puts "NO" end