#include <bits/stdc++.h>
using namespace std;
vector<int> adj[1000010];
int n, k, ans;
int dfs(int u, int fa = 0) {
  if (adj[u].size() == 1) return 0;
  vector<int> vec;
  for (int v : adj[u]) {
    if (v == fa) continue;
    vec.push_back(dfs(v, u) + 1);
  }
  sort(vec.begin(), vec.end());
  while (vec.size() > 1) {
    int sz = vec.size();
    if (vec[sz - 1] + vec[sz - 2] <= k) break;
    ans++;
    vec.pop_back();
  }
  return vec.back();
}
int main() {
  ios_base ::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> k;
  for (int i = 1; i < n; i++) {
    int u, v;
    cin >> u >> v;
    adj[u].push_back(v);
    adj[v].push_back(u);
  }
  for (int i = 1; i <= n; i++) {
    if (adj[i].size() > 1) {
      dfs(i);
      break;
    }
  }
  cout << (ans + 1) << endl;
}
