let () =
  let n = Scanf.scanf "%d\n" (fun n -> n) in
  let k = Scanf.scanf "%d\n" (fun k -> k) in
  Array.make n (fun x -> min (2 * x) (x + k))
  |> Array.fold_left (fun x f -> f x) 1
  |> Printf.printf "%d\n"