#include <bits/stdc++.h>
using namespace std;
long long i, i1, j, k, k1, t, n, m, res, flag[10], a, b, dg[1000010], r,
    dist[1000010];
bool visited[1000010];
vector<long long> adj[1000010];
multiset<long long> sbs[1000010];
void merge(long long s) {
  while (true) {
    if (sbs[s].size() < 2) break;
    a = (*sbs[s].begin());
    sbs[s].erase(sbs[s].begin());
    b = (*sbs[s].begin());
    sbs[s].erase(sbs[s].begin());
    if (a + b - 2 * dist[s] <= k) {
      sbs[s].insert(b);
    } else {
      sbs[s].insert(a);
      sbs[s].insert(b);
      break;
    }
  }
}
void clean(long long s) {
  while (true) {
    if (sbs[s].size() < 2) break;
    a = (*prev(sbs[s].end()));
    sbs[s].erase(prev(sbs[s].end()));
    b = (*prev(sbs[s].end()));
    sbs[s].erase(prev(sbs[s].end()));
    if (a + b - 2 * dist[s] > k) {
      sbs[s].insert(b);
      res++;
    } else {
      sbs[s].insert(a);
      sbs[s].insert(b);
      break;
    }
  }
}
void dfs(long long s) {
  long long flag = 1;
  for (auto u : adj[s]) {
    if (visited[u]) continue;
    visited[u] = true;
    flag = 0;
    dist[u] = dist[s] + 1;
    dfs(u);
    if (sbs[s].size() < sbs[u].size()) swap(sbs[s], sbs[u]);
    for (auto x : sbs[u]) sbs[s].insert(x);
  }
  merge(s);
  clean(s);
  if (flag == 1) sbs[s].insert(dist[s]);
}
void init(long long s) {
  for (i = 1; i <= n; i++) visited[i] = false;
  visited[s] = true;
  dist[s] = 0;
  dfs(s);
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> k;
  for (i = 0; i < n - 1; i++) {
    cin >> a >> b;
    adj[a].push_back(b);
    adj[b].push_back(a);
    dg[a]++;
    dg[b]++;
  }
  for (r = 1; r <= n; r++) {
    if (dg[r] > 1) break;
  }
  res = 0;
  init(r);
  cout << sbs[r].size() + res;
  return 0;
}
