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 if k < count / 2 puts "NO" elsif k % 2 == (count / 2) % 2 puts "YES" else puts "NO" end