use std::io::{self, BufRead}; use std::collections::{HashMap, LinkedList}; fn main() { let stdin = io::stdin(); let line = stdin.lock().lines().next().unwrap().unwrap(); let v = line.split(" ").collect::>() .iter().map( |x| x.to_string()).map(|x| x.parse::().unwrap() ).collect::>(); let (n, k) = (v[0], v[1]); let line = stdin.lock().lines().next().unwrap().unwrap(); let mut v = line.split(" ").collect::>() .iter().map( |x| x.to_string()).map(|x| x.parse::().unwrap() ).collect::>(); let mut va = v.clone(); va.sort(); let mut cnt = 0; for i in (0..v.len()) { if v[i] != va[i] { let mut toswap = 0; for j in (i..v.len()) { if v[j] == va[i] { toswap = j; cnt += 1; break; } } let tmp = v[toswap].clone(); v[toswap] = v[i]; v[i] = tmp; if v == va { break; } } } if k < cnt { println!("NO"); }else if (k - cnt)%2 == 0 { println!("YES"); }else { println!("NO"); } }