#include <bits/stdc++.h>
using namespace std;

int main() {
  int n, limit;
  cin >> n >> limit;
  vector<vector<int>> adj;
  adj.resize(n);
  for (int i = 1; i < n; ++i) {
    int u, v;
    cin >> u >> v, --u, --v;
    adj[u].push_back(v);
    adj[v].push_back(u);
  }

  function<int(int, int, int)> dfs = [&](int u, int father, int height) {
    int answer = height < 0;
    for (int v : adj[u]) {
      if (v != father) {
        answer += dfs(v, u, height - 1);
      }
    }
    return answer;
  };

  int answer = n;
  if (~limit & 1) {
    for (int u = 0; u < n; ++u) {
      answer = min(answer, dfs(u, -1, limit / 2));
    }
  } else {
    for (int u = 0; u < n; ++u) {
      for (int v : adj[u]) {
        int a = dfs(u, v, limit / 2);
        int b = dfs(v, u, limit / 2);
        answer = min(answer, a + b);
      }
    }
  }
  cout << answer << endl;

  return 0;
}