#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2010;
const int mod = 1000000009;
int n;
vector<int> adj[MAXN];
bitset<MAXN> del, vis;
int p[MAXN];
int count(int u) {
  int par = p[u];
  if (par == -1) return 1;
  if (del[par]) return 1;
  int cnt = 0;
  for (auto &v : adj[par]) {
    cnt += !del[v] && v != p[par];
  }
  return cnt;
}
int ret;
int len;
int curcnt;
void dfs(int u, int l = 0, int par = -1) {
  p[u] = par;
  vis[u] = true;
  if (l > len || (l == len && count(u) < curcnt)) {
    curcnt = count(u);
    len = l;
    ret = u;
  }
  for (auto &v : adj[u])
    if (!vis[v] && !del[v]) {
      dfs(v, l + 1, u);
    }
}
int st = 1;
void ser(int u) {
  vis = 0;
  dfs(u);
}
void init() {
  ret = 0;
  len = 0;
  curcnt = 0;
  vis = 0;
}
int k;
int main() {
  int ans = 0;
  cin >> n >> k;
  for (int i = 0; i < n - 1; i++) {
    int u, v;
    cin >> u >> v;
    adj[u].push_back(v);
    adj[v].push_back(u);
  }
  while (true) {
    while (del[st]) st++;
    init();
    ser(st);
    ser(ret);
    ser(ret);
    if (len <= k) break;
    ans++;
    del[ret] = true;
  }
  cout << ans << "\n";
}
