#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e6 + 10;
int n, k, answer;
vector<int> adj[maxn];
int dfs(int u, int p) {
  if ((int)adj[u].size() == 1) return 0;
  vector<int> c;
  for (int v : adj[u])
    if (v != p) {
      c.push_back(dfs(v, u) + 1);
    }
  sort(c.begin(), c.end());
  while ((int)c.size() > 1 && c.back() + c[(int)c.size() - 2] > k) {
    answer++;
    c.pop_back();
  }
  return c.back();
}
int main() {
  scanf("%d%d", &n, &k);
  for (int i = 1; i < n; ++i) {
    int u, v;
    scanf("%d%d", &u, &v);
    adj[u].push_back(v);
    adj[v].push_back(u);
  }
  for (int i = 1; i <= n; ++i)
    if ((int)adj[i].size() > 1) {
      dfs(i, i);
      break;
    }
  printf("%d\n", answer + 1);
  return 0;
}
