let () = Scanf.scanf "%d %d\n" @@ fun n k ->
  let xys = Array.init n @@ fun _ ->
    Scanf.scanf "%d %d\n" @@ fun x y -> x, y in
  Array.sort (fun (v, w) (x, y) -> compare (v, ~- w) (x, ~- y)) xys;
  begin List.concat @@ Array.to_list @@ Array.init (n - k + 1) @@ fun i ->
    Array.to_list @@ Array.init (n - i - k + 1) @@ fun j -> (i, k + j) end
  |> List.map (fun (i, j) ->
      let xys' = Array.init j (fun k -> snd xys.(i + k)) in
      (fst xys.(i + j - 1) - fst xys.(i)) * (Array.fold_left max min_int xys' - Array.fold_left min max_int xys'))
  |> List.fold_left min max_int
  |> Printf.printf "%d\n"
