#include <bits/stdc++.h>
using namespace std;
using LL = long long;
using PII = pair<int, int>;
const int N = 1e6 + 5;
int n, k, ans = 0, f[N];
vector<int> g[N];
void dfs(int u, int p) {
  vector<int> deps;
  deps.push_back(0);
  for (auto v : g[u]) {
    if (v != p) {
      dfs(v, u);
      if (f[v] == -1) continue;
      deps.push_back(f[v] + 1);
    }
  }
  sort(deps.begin(), deps.end());
  while (deps.size() > 1u) {
    int max_dist = deps.back() + *prev(deps.end(), 2);
    if (max_dist > k) {
      deps.pop_back();
      ans++;
    } else
      break;
  }
  if (g[u].size() > 1u && deps.size() == 1u)
    f[u] = -1;
  else
    f[u] = deps.back();
}
int main() {
  cin >> n >> k;
  for (int i = (2); i <= (n); ++i) {
    int u, v;
    scanf("%d%d", &u, &v);
    g[u].push_back(v);
    g[v].push_back(u);
  }
  int u = 1;
  for (int i = (1); i <= (n); ++i) {
    if (g[i].size() != 1) {
      u = i;
    }
  }
  dfs(u, 0);
  if (f[u] > 0) ans++;
  cout << ans << endl;
}
