#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 10;
int n, k, root, ans;
vector<int> g[N];
int dfs(int u, int f) {
  if (g[u].size() == 1) return 0;
  vector<int> d;
  for (int v : g[u])
    if (v != f) d.push_back(dfs(v, u) + 1);
  sort(d.begin(), d.end());
  int sz = d.size();
  while (sz >= 2) {
    if (d[sz - 1] + d[sz - 2] <= k) break;
    ans++, sz--;
    d.pop_back();
  }
  int ret = d.back();
  d.clear();
  return ret;
}
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) {
      root = i;
      break;
    }
  dfs(root, -1);
  printf("%d", ans + 1);
  return 0;
}
