#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 10;
int k, ecnt, cnt[N], first[N];
struct Edge {
  int to, next;
} e[2 * N];
multiset<int> val[N];
void Eadd(int a, int b) {
  e[++ecnt].to = b;
  e[ecnt].next = first[a];
  first[a] = ecnt;
  e[++ecnt].to = a;
  e[ecnt].next = first[b];
  first[b] = ecnt;
}
void dfs(int v, int d, int p) {
  if (cnt[v] == 1) {
    val[v].insert(d);
    return;
  }
  int bst = -1;
  for (int i = first[v], u; i; i = e[i].next)
    if ((u = e[i].to) != p) {
      dfs(u, d + 1, v);
      if (bst == -1 || val[u].size() > val[bst].size()) bst = u;
    }
  swap(val[v], val[bst]);
  for (int i = first[v], u; i; i = e[i].next)
    if ((u = e[i].to) != p && u != bst)
      for (auto it : val[u]) {
        int len = k + d + d - it;
        auto jt = val[v].upper_bound(len);
        if (jt == val[v].begin()) {
          val[v].insert(it);
        } else {
          --jt;
          int t = max(it, *jt);
          val[v].erase(jt);
          val[v].insert(t);
        }
      }
}
int main() {
  int n;
  scanf("%d %d", &n, &k);
  for (int i = 1, v, u; i < n; ++i) {
    scanf("%d %d", &v, &u);
    Eadd(v, u);
    ++cnt[v];
    ++cnt[u];
  }
  for (int i = 1; i <= n; ++i)
    if (cnt[i] != 1) {
      dfs(i, 0, -1);
      printf("%d", val[i].size());
      break;
    }
  return 0;
}
