n,k = gets.chomp.split(" ").map(&:to_i) a = gets.chomp.split(" ").map(&:to_i) count = 0 t = [] (0..(n-1)).each do |d| t[a[d]-1] = d end (0..(n-1)).each do |d| if(a[d] != (d+1)) count += 1 ind = t[d] a[ind] = a[d] end end test = k - (count) if (test < 0) puts "NO" exit end puts (test%2 == 0)? "YES" : "NO"