#include <bits/stdc++.h>
using namespace std;
inline char gc() {
  static char buf[100000], *p1 = buf, *p2 = buf;
  return p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 100000, stdin), p1 == p2)
             ? EOF
             : *p1++;
}
inline int read() {
  char c = getchar();
  int tot = 1;
  while ((c < '0' || c > '9') && c != '-') c = getchar();
  if (c == '-') {
    tot = -1;
    c = getchar();
  }
  int sum = 0;
  while (c >= '0' && c <= '9') {
    sum = sum * 10 + c - '0';
    c = getchar();
  }
  return sum * tot;
}
inline void wr(int x) {
  if (x < 0) {
    putchar('-');
    wr(-x);
    return;
  }
  if (x >= 10) wr(x / 10);
  putchar(x % 10 + '0');
}
inline void wrn(int x) {
  wr(x);
  putchar('\n');
}
inline void wri(int x) {
  wr(x);
  putchar(' ');
}
inline void wrn(int x, int y) {
  wri(x);
  wrn(y);
}
inline void wrn(int a, int b, int c) {
  wri(a);
  wrn(b, c);
}
int n, m, ans, fa[1000055], dis[1000055], k, in1[1000055];
vector<int> a[1000055];
int nedge, Next[1000055 * 2], head[1000055], to[1000055 * 2];
void add(int a, int b) {
  Next[++nedge] = head[a];
  head[a] = nedge;
  to[nedge] = b;
}
void add_ne(int a, int b) {
  add(a, b);
  add(b, a);
  in1[a]++;
  in1[b]++;
}
void dfs(int x) {
  for (int i = head[x]; i; i = Next[i]) {
    if (fa[x] == to[i]) continue;
    fa[to[i]] = x;
    dfs(to[i]);
    a[x].push_back(dis[to[i]] + 1);
  }
  if (a[x].size() == 0) return;
  sort(a[x].begin(), a[x].end());
  int num = 0;
  for (int i = (1); i <= (a[x].size() - 1); i++) {
    if (a[x][i] + a[x][i - 1] <= k) num = i;
  }
  ans += a[x].size() - num - 1;
  dis[x] = a[x][num];
}
signed main() {
  n = read();
  k = read();
  for (int i = (1); i <= (n - 1); i++) add_ne(read(), read());
  for (int i = (1); i <= (n); i++) {
    if (in1[i] >= 2) {
      dfs(i);
      break;
    }
  }
  wrn(ans + 1);
  return 0;
}
