#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
using namespace std;

typedef pair<int, int> P;

int N, K;
vector<int> G[2000];
P E[2000];

int dfs(int s, int p, int d) {
  if (d == 0) return 1;
  int c = 1;
  for (int t : G[s]) {
    if (t == p) continue;
    c += dfs(t, s, d-1);
  }
  return c;
}

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);
    E[i] = P(a, b);
  }

  int s = 1;
  if (K % 2 == 0) {
    for (int i=0; i<N; i++) {
      s = max(s, dfs(i, -1, K/2));
    }
  }
  else {
    for (int i=0; i<N-1; i++) {
      int a = E[i].first, b = E[i].second;
      s = max(s, dfs(a, b, (K-1)/2) + dfs(b, a, (K-1)/2));
    }
  }
  cout << N - s << "\n";
  return 0;
}
