n, k = gets.strip.split(' ').map(&:to_i) d = gets.strip.split(' ').map(&:to_i) count = 0 (1..n).each do |i| count += 1 if d[i - 1] != i end # p count if count == 0 && k % 2 == 0 puts "YES" elsif count == 0 && k % 2 == 1 puts "NO" elsif count % 2 == 1 && k % 2 == 0 puts "YES" elsif count % 2 == 0 && k % 2 == 1 puts "YES" else puts "NO" end