let () = Scanf.scanf "%d %d\n" @@ fun n k ->
  let abs = Array.init (n - 1) @@ fun _ ->
    Scanf.scanf "%d %d\n" @@ fun a b -> a, b in
  let es = Array.make n [] in
  Array.iter (fun (a, b) ->
    es.(a - 1) <- b - 1 :: es.(a - 1);
    es.(b - 1) <- a - 1 :: es.(b - 1)) abs;
  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 min max_int @@
  if k mod 2 = 0 then
    Array.init n @@ fun v ->
      Array.fold_left (fun acc u ->
        acc + (if k / 2 < d.(u).(v) then 1 else 0)) 0 @@
      Array.init n @@ fun u -> u
  else
    Array.map (fun (a, b) ->
      Array.fold_left (fun acc u ->
        acc + (if k / 2 < min d.(a - 1).(u) d.(b - 1).(u) then 1 else 0)) 0 @@
      Array.init n @@ fun u -> u) abs
