let read_ints () = read_line () |> String.split_on_char ' ' |> List.map int_of_string;;
let inf = 1000000000;;

let [n; l] = read_ints ();;
let a = List.init n (fun i -> l + i);;
let s = List.fold_left ( + ) 0 a;;
let ans = List.fold_left (fun x y -> min x (abs y, s - y)) (inf, inf) a;;
print_int (snd ans);;
print_newline ();;
