#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 100;
const long long mod = 998244353;
int n, k, ans;
vector<int> g[N];
int dfs(int u, int h, int p = -1) {
  if (g[u].size() == 1) {
    return 0;
  }
  vector<int> v;
  for (int x : g[u])
    if (x - p) {
      v.push_back(dfs(x, h + 1, u) + 1);
    }
  sort(v.begin(), v.end());
  while (v.size() >= 2) {
    if (v.back() + v[v.size() - 2] > k) {
      v.pop_back();
      ++ans;
    } else {
      break;
    }
  }
  return v.back();
}
int main(int argc, const char* argv[]) {
  scanf("%d %d", &n, &k);
  for (int i = 1; i <= n - 1; ++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);
      printf("%d\n", ans + 1);
      return 0;
    }
  return 0;
}
