#include <bits/stdc++.h>
using namespace std;
const long long int N = 1000010;
vector<long long int> g[N];
long long int wyn = 0, n, k;
long long int dfs(long long int u, long long int p) {
  if (g[u].size() == 1) return 0;
  vector<long long int> holis;
  for (auto x : g[u])
    if (x != p) holis.push_back(dfs(x, u) + 1);
  sort(holis.begin(), holis.end());
  long long int the_jael = 0;
  for (long long int i = holis.size() - 1; i >= 1 and holis.size() >= 2; i--) {
    if (holis[i] + holis[i - 1] <= k) {
      the_jael = i;
      break;
    }
    wyn++;
  }
  return holis[the_jael];
}
int main() {
  scanf("%lld %lld", &n, &k);
  for (long long int i = 0; i < n - 1; i++) {
    long long int a, b;
    scanf("%lld %lld", &a, &b);
    g[a].push_back(b);
    g[b].push_back(a);
  }
  for (long long int i = 1; i <= n; i++)
    if (g[i].size() > 1) {
      dfs(i, -1);
      break;
    }
  wyn++;
  printf("%lld", wyn);
  return 0;
}
