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