#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e6;
int n, k;
int root;
vector<int> G[MAXN + 10];
int res = 0;
int dfs(int u, int p = -1) {
  if ((int)G[u].size() == 1) return 0;
  vector<int> d;
  for (int v : G[u]) {
    if (v == p) continue;
    d.push_back(dfs(v, u) + 1);
  }
  sort(d.begin(), d.end(), greater<int>());
  while (d.size() > 1) {
    int b = d.back();
    d.pop_back();
    int a = d.back();
    d.pop_back();
    if (a + b > k) {
      res += d.size() + 1;
      return b;
    } else {
      d.push_back(a);
    }
  }
  return d[0];
}
int main() {
  scanf("%d%d", &n, &k);
  for (int i = 0; i < n - 1; i++) {
    int u, v;
    scanf("%d%d", &u, &v);
    G[u].push_back(v);
    G[v].push_back(u);
  }
  root = 1;
  while ((int)G[root].size() == 1) ++root;
  dfs(root);
  res++;
  printf("%d\n", res);
}
