use std::{cmp::max, io}; fn main() { let (N, X) = read(); let mut A = vec![]; let mut B = vec![]; for _ in 0..N { let (a, b) = read(); A.push(a); B.push(b); } let mut C = vec![]; for j in 1..=X { let mut mx = 0; for i in 0..N { let tmp = if B[i] >= j.abs_diff(A[i]) { B[i] - j.abs_diff(A[i]) } else { 0 }; mx = max(mx, tmp) } C.push(mx); } println!("{}", C.iter().map(|v| v.to_string()).collect::>().join(" ")); } fn read() -> (usize, usize) { let mut line = String::new(); io::stdin().read_line(&mut line).unwrap(); let tokens = line.split_whitespace().map(|v| v.parse::<_>().unwrap()).collect::>(); (tokens[0], tokens[1]) }