#include <bits/stdc++.h>
using namespace std;
int n, k, col[1000006], ans, to[1000006 << 1], nxt[1000006 << 1], head[1000006],
    cnt;
void add(int x, int y) { to[++cnt] = y, nxt[cnt] = head[x], head[x] = cnt; }
int dfs(int now, int pre) {
  if (col[now] == 1) {
    return 0;
  }
  priority_queue<int> q;
  for (int i = head[now]; i; i = nxt[i]) {
    int y = to[i];
    if (y != pre) {
      q.push(dfs(y, now) + 1);
    }
  }
  int ret = q.top();
  q.pop();
  while (!q.empty()) {
    if (q.top() + ret <= k) {
      return ret;
    }
    ret = q.top();
    q.pop();
    ans++;
  }
  return ret;
}
int main() {
  scanf("%d%d", &n, &k);
  for (int i = 1, ui, vi; i < n; i++) {
    scanf("%d%d", &ui, &vi);
    add(ui, vi);
    add(vi, ui);
    col[ui]++, col[vi]++;
  }
  for (int i = 1; i <= n; i++) {
    if (col[i] > 1) {
      dfs(i, 0);
      break;
    }
  }
  printf("%d\n", ans + 1);
  return 0;
}
