#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 10;
vector<int> G[N];
int dep[N], g[N], f[N];
vector<int> v;
map<int, int> mmp;
int n, k;
void dfs(int u, int fa) {
  int cnt = 0;
  dep[u] = dep[fa] + 1;
  bool up = 0;
  for (auto x : G[u]) {
    if (x != fa) {
      up = 1;
      dfs(x, u);
      cnt += f[x];
    }
  }
  if (!up) {
    g[u] = dep[u];
    f[u] = 1;
    return;
  }
  mmp.clear();
  v.clear();
  for (auto x : G[u]) {
    if (x != fa) {
      mmp[g[x]]++;
    }
  }
  for (auto it = mmp.begin(); it != mmp.end(); ++it) {
    int num = it->second;
    int x = it->first;
    while (num) {
      v.push_back(x);
      num--;
    }
  }
  int sz = v.size();
  int mx = v[sz - 1];
  for (int i = sz - 2; i >= 0; i--) {
    if (v[i] + mx - 2 * dep[u] <= k) {
      cnt--;
    } else {
      mx = v[i];
    }
  }
  f[u] = cnt;
  g[u] = mx;
}
int main() {
  scanf("%d%d", &n, &k);
  for (int i = 1; i < n; i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    G[x].push_back(y);
    G[y].push_back(x);
  }
  int rt = 0;
  for (int i = 1; i <= n; i++) {
    if (G[i].size() >= 2) {
      rt = i;
    }
  }
  dfs(rt, 0);
  cout << f[rt] << endl;
  return 0;
}
