#include <bits/stdc++.h>
using namespace std;
template <typename T>
void uin(T &a, T b) {
  if (b < a) a = b;
}
template <typename T>
void uax(T &a, T b) {
  if (b > a) a = b;
}
const long long N = 2003;
long long n, k;
vector<long long> g[N];
long long dp[N], h[N], tin[N], tout[N], timer = 0;
;
void dfs(long long v, long long par = -1) {
  if (par == -1)
    h[v] = 0;
  else
    h[v] = h[par] + 1;
  tin[v] = ++timer;
  dp[v] = 1;
  for (long long to : g[v]) {
    if (to == par) continue;
    dfs(to, v);
    dp[v] += dp[to];
  }
  tout[v] = ++timer;
}
bool anc(long long u, long long v) {
  return tin[u] <= tin[v] && tout[u] >= tout[v];
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> k;
  for (long long i = 0; i < n - 1; ++i) {
    long long u, v;
    cin >> u >> v;
    g[u].emplace_back(v);
    g[v].emplace_back(u);
  }
  long long ans = n;
  for (long long c = 1; c <= n; ++c) {
    for (long long i = 1; i <= n; ++i) dp[i] = n + n + n;
    dfs(c);
    if (k % 2 == 0) {
      long long cur = 0;
      for (long long v = 1; v <= n; ++v) {
        if (h[v] == k / 2) {
          cur += dp[v] - 1;
        }
      }
      uin(ans, cur);
    } else {
      long long sz = (long long)g[c].size();
      vector<long long> val1(sz), val2(sz);
      long long sum = 0;
      for (long long i = 0; i < g[c].size(); ++i) {
        long long to = g[c][i];
        for (long long v = 1; v <= n; ++v) {
          if (anc(to, v)) {
            if (h[v] == k / 2)
              val1[i] += dp[v] - 1;
            else if (h[v] == k / 2 + 1)
              val2[i] += dp[v] - 1;
          }
        }
        sum += val1[i];
      }
      uin(ans, sum);
      for (long long i = 0; i < sz; ++i) {
        uin(ans, sum - val1[i] + val2[i]);
      }
    }
  }
  cout << ans << endl;
  return 0;
}
