#include <bits/stdc++.h>

using namespace std;


int N, K;
vector< int > g[2000];
bool v[2000];

int feel(int idx, int depth)
{
  if(depth < 0 || v[idx]++) return (0);
  int ret = 1;
  for(auto &to : g[idx]) ret += feel(to, depth - 1);
  return (ret);
}

int main()
{
  cin >> N >> K;
  for(int i = 0; i < N - 1; i++) {
    int A, B;
    cin >> A >> B;
    --A, --B;
    g[A].push_back(B);
    g[B].push_back(A);
  }

  int ret = 0;
  if(K & 1) {
    for(int i = 0; i < N; i++) {
      for(auto &to : g[i]) {
        memset(v, false, sizeof(v));
        v[to] = true;
        int proc = feel(i, K / 2);
        v[to] = false;
        proc += feel(to, K / 2);
        ret = max(ret, proc);
      }
    }
  } else {
    for(int i = 0; i < N; i++) {
      memset(v, false, sizeof(v));
      ret = max(ret, feel(i, K / 2));
    }
  }

  cout << N - ret << endl;

}