#include <bits/stdc++.h>
using namespace std;
const double PI = acos(-1.0);
typedef tuple<int, int> i2;
typedef tuple<int, int, int> i3;
typedef tuple<int, int, int, int> i4;
typedef vector<int> vi;
typedef vector<i2> vi2;
typedef vector<i3> vi3;
typedef vector<i4> vi4;
typedef vector<vi> v2i;
typedef vector<vi2> v2i2;
typedef vector<string> vs;
typedef vector<long long> vll;
long long modPow(long long b, long long p, long long m) {
  b %= m;
  if (p <= 1) return p == 0 ? 1 : b;
  long long res = modPow(b * b, p / 2, m);
  return p % 2 == 0 ? res : (res * b) % m;
}
int k, res;
vi g[1234567];
int dfs(int cur, int p) {
  if (g[cur].size() < 2) return 0;
  priority_queue<int, vi, greater<int> > pq;
  for (int neigh : g[cur]) {
    if (neigh == p) continue;
    pq.push(dfs(neigh, cur) + 1);
  }
  while (pq.size() > 1) {
    int a = pq.top();
    pq.pop();
    int b = pq.top();
    pq.pop();
    if (a + b <= k)
      pq.push(b);
    else {
      pq.push(a);
      pq.push(b);
      break;
    }
  }
  res += pq.size() - 1;
  return pq.top();
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n >> k;
  int x;
  for (int i = 0; i < n - 1; ++i) {
    int a, b;
    cin >> a >> b;
    g[a].push_back(b);
    g[b].push_back(a);
    if (g[a].size() > 1) x = a;
    if (g[b].size() > 1) x = b;
  }
  dfs(x, -1);
  cout << res + 1 << '\n';
  return 0;
}
