fn main() { let mut nm = String::new(); std::io::stdin().read_line(&mut nm).ok(); let nm: Vec = nm.trim().split_whitespace().map(|s| s.parse().unwrap()).collect(); let n = nm[0]; let m = nm[1]; if m+1 < n { println!("NO"); return; } let mut points = vec![0usize; n]; let mut maxval = n; let mut minval = 1usize; for i in 0..n { if i % 2 == 0 { points[i] = minval; minval += 1; } else { points[i] = maxval; maxval -= 1; } } let mut lines = (1..n).map(|i| (i, i+1)).collect::>(); let mut size = 4usize; while size <= n { for i in 1.. { if lines.len() == m { break; } if i+size-1 > n { break; } lines.push((i, i+size-1)); } if lines.len() == m { break; } size += 2; } if lines.len() == m { println!("YES"); println!("{}", points.iter().map(|v| v.to_string()).collect::>().join(" ")); for &(l, r) in lines.iter() { println!("{} {}", l, r); } } else { println!("NO"); } }