#include <bits/stdc++.h>
using namespace std;
void read(int &v) {
  int f;
  char ch;
  while (!isdigit(ch = getchar()) && ch != '-')
    ;
  ch == '-' ? (f = -1, v = 0) : (f = 1, v = ch - '0');
  while (isdigit(ch = getchar())) v = v * 10 + ch - '0';
  v = v * f;
}
const int N = 1e6 + 5;
struct sd {
  int next, to;
  sd(){};
  sd(int a, int b) { next = a, to = b; }
} edge[N << 1];
int head[N], du[N], dis[N], n, k, root, cnt, ans;
void add_edge(int from, int to) {
  edge[++cnt] = sd(head[from], to), head[from] = cnt;
  edge[++cnt] = sd(head[to], from), head[to] = cnt;
}
void dfs(int v, int ff) {
  for (int i = head[v]; i; i = edge[i].next) {
    int to = edge[i].to;
    if (to == ff) continue;
    dfs(to, v);
    if (!dis[to] && du[to] > 1) continue;
    if (dis[to] + dis[v] + 1 > k)
      dis[v] = min(dis[v], dis[to] + 1), ans++;
    else
      dis[v] = max(dis[v], dis[to] + 1);
  }
}
int main() {
  int a, b;
  read(n), read(k);
  for (int i = 1; i < n; i++)
    read(a), read(b), add_edge(a, b), du[a]++, du[b]++;
  for (int i = 1; i <= n; i++)
    if (du[i] != 1) {
      root = i;
      break;
    }
  dfs(root, 0);
  if (dis[root]) ans++;
  printf("%d", ans);
  return 0;
}
