#include <bits/stdc++.h>
using namespace std;
int ans = 2e9, tot, n, d[2005], m, dep[2005];
struct papa {
  int to, next;
} e[2005 << 1];
inline void addedge(int x, int y) {
  e[++tot].to = y;
  e[tot].next = d[x];
  d[x] = tot;
}
inline int read() {
  int X = 0, w = 0;
  char ch = 0;
  while (!isdigit(ch)) {
    w |= ch == '-';
    ch = getchar();
  }
  while (isdigit(ch)) X = (X << 3) + (X << 1) + (ch ^ 48), ch = getchar();
  return w ? -X : X;
}
inline void dfs(int now, int fa) {
  if (dep[now] > (m >> 1)) tot++;
  for (int i = d[now]; i; i = e[i].next) {
    int x = e[i].to;
    if (x == fa) continue;
    dep[x] = dep[now] + 1;
    dfs(x, now);
  }
}
int main() {
  n = read(), m = read();
  for (int i = 1; i < n; i++) {
    int x = read(), y = read();
    addedge(x, y), addedge(y, x);
  }
  if (m & 1) {
    for (int i = 1; i <= n; i++)
      for (int j = d[i]; j; j = e[j].next) {
        int x = e[j].to;
        tot = 0, dep[x] = 0;
        dfs(x, i);
        dep[i] = 0;
        dfs(i, x);
        ans = min(ans, tot);
      }
    printf("%d\n", ans);
    return 0;
  }
  for (int i = 1; i <= n; i++)
    tot = 0, dep[i] = 0, dfs(i, -1), ans = min(ans, tot);
  printf("%d\n", ans);
}
