module IntSet = Set.Make (struct
  type t = int
  let compare = compare
end)

let () = Scanf.scanf "%d %d\n" @@ fun n k ->
  let es = Array.make n [] in
  for i = 0 to n - 2 do
    Scanf.scanf "%d %d\n" @@ fun a b ->
      es.(a - 1) <- b - 1 :: es.(a - 1);
      es.(b - 1) <- a - 1 :: es.(b - 1);
  done;
  let d = Array.make_matrix n n min_int in
  for s = 0 to n - 1 do
    let rec dfs v =
      List.iter (fun u ->
        if d.(s).(u) < 0 then 
          (d.(s).(u) <- 1 + d.(s).(v); dfs u)) es.(v) in
    d.(s).(s) <- 0; dfs s
  done;
  Printf.printf "%d\n" @@
    Array.fold_left (fun m d ->
      let (dim, acc) = Array.fold_left (fun (dim, acc) d ->
        (dim + if d = 1 then 1 else 0),
        (acc + if k < d then 1 else 0)) (0, 0) d in
      min m @@ if dim <> 1 then max_int else acc) max_int d
