#include <bits/stdc++.h>
using namespace std;
vector<int> g[10000005];
int n, k, ans;
int dfs(int u, int f) {
  if (g[u].size() == 1) return 1;
  vector<int> t;
  for (int v = 0; v < g[u].size(); ++v)
    if (g[u][v] != f) t.push_back(dfs(g[u][v], u));
  sort(t.begin(), t.end());
  while (t.size() >= 2) {
    if (t.back() + t[t.size() - 2] <= k) break;
    ++ans;
    t.pop_back();
  }
  return t.back() + 1;
}
int main() {
  scanf("%d%d", &n, &k);
  for (int i = 1; i < n; ++i) {
    int u, v;
    scanf("%d%d", &u, &v);
    g[u].push_back(v), g[v].push_back(u);
  }
  for (int i = 1; i <= n; ++i)
    if (g[i].size() > 1) {
      dfs(i, 0);
      break;
    }
  printf("%d", ans + 1);
}
