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" @@ ( - ) n @@ Array.fold_left max min_int @@ Array.init n @@ fun u ->
    let (_, vs, ws) = Array.fold_left (fun (v, vs, ws) d ->
      (v + 1),
      (if k <> d then vs else v :: vs),
      (if k < d  then ws else v :: ws)) (0, [], []) d.(u) in
    if
      List.exists (fun v ->
        List.exists (fun w ->
          k < d.(v).(w)) ws) vs
    then min_int
    else List.length ws
