#include <bits/stdc++.h>
using namespace std;
pair<int, int> processTree(int n, vector<vector<int> > &tree, int max_dis) {
  if (tree[n].size() == 0) return make_pair(1, 0);
  pair<int, int> result(0, 0);
  vector<int> depths;
  for (auto &c : tree[n]) {
    tree[c].erase(find(tree[c].begin(), tree[c].end(), n));
    pair<int, int> cur_res = processTree(c, tree, max_dis);
    result.first += cur_res.first - 1;
    depths.push_back(cur_res.second + 1);
  }
  sort(depths.begin(), depths.end());
  for (int i = 0, j; i < depths.size();) {
    result.first++;
    for (j = i + 1; j < depths.size(); j++) {
      if (depths[j] + depths[j - 1] > max_dis) break;
    }
    if (i == 0) result.second = depths[j - 1];
    i = j;
  }
  return result;
}
int main() {
  ios_base::sync_with_stdio(false);
  int num_verts, max_dis, root = -1;
  cin >> num_verts >> max_dis;
  vector<vector<int> > tree(num_verts);
  for (int i = 0, v1, v2; i < tree.size() - 1; i++) {
    cin >> v1 >> v2;
    v1--;
    v2--;
    tree[v1].push_back(v2);
    tree[v2].push_back(v1);
  }
  for (int i = 0; i < tree.size(); i++)
    if (tree[i].size() > 1) {
      root = i;
      break;
    }
  pair<int, int> result = processTree(root, tree, max_dis);
  cout << result.first << '\n';
  return 0;
}
