use proconio::input; fn main() { input! { n:usize, mut k:usize, a:[usize;n], } let mut b = vec![]; for i in 0..n - 1 { if a[i] <= a[i + 1] { if n - i == k { for j in i + 1..n { b.push(a[j]); } break; } else { b.push(a[i]); } } else { if 1 == k { for j in i + 1..n { b.push(a[j]); } break; } else { b.push(a[i]); k -= 1; } } } for bi in b.iter() { print!("{} ", *bi); } println!(); }