#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 5;
template <typename T>
bool cmax(T &a, T b) {
  return (a < b) ? a = b, 1 : 0;
}
template <typename T>
bool cmin(T &a, T b) {
  return (a > b) ? a = b, 1 : 0;
}
template <typename T>
T read() {
  T ans = 0, f = 1;
  char ch = getchar();
  while (!isdigit(ch) && ch != '-') ch = getchar();
  if (ch == '-') f = -1, ch = getchar();
  while (isdigit(ch))
    ans = (ans << 3) + (ans << 1) + (ch - '0'), ch = getchar();
  return ans * f;
}
template <typename T>
void write(T x, char y) {
  if (x == 0) {
    putchar('0'), putchar(y);
    return;
  }
  if (x < 0) {
    putchar('-');
    x = -x;
  }
  static char wr[20];
  int top = 0;
  for (; x; x /= 10) wr[++top] = x % 10 + '0';
  while (top) putchar(wr[top--]);
  putchar(y);
}
void file() {}
int n, k;
vector<int> E[N];
int d[N];
void input() {
  int x, y;
  n = read<int>(), k = read<int>();
  for (register int i = (int)(2); i <= (int)(n); ++i) {
    x = read<int>(), y = read<int>();
    E[x].push_back(y), E[y].push_back(x);
    d[x]++, d[y]++;
  }
}
int dep[N], dp[N];
int q[N], top, ans;
void DP(int u, int pre) {
  dep[u] = dep[pre] + 1;
  if (d[u] == 1) {
    dp[u] = dep[u];
    return;
  }
  for (int v : E[u])
    if (v ^ pre) DP(v, u);
  top = 0;
  for (int v : E[u])
    if (v ^ pre) q[++top] = dp[v];
  sort(q + 1, q + top + 1);
  int pos = top;
  while (pos > 1 && q[pos] + q[pos - 1] - dep[u] * 2 > k) ans++, pos--;
  dp[u] = q[pos];
}
void work() {
  for (register int i = (int)(1); i <= (int)(n); ++i)
    if (d[i] > 1) {
      DP(i, 0);
      break;
    }
  write(ans + 1, '\n');
}
int main() {
  file();
  input();
  work();
  return 0;
}
