#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 5;
int n, k, x, y;
int len[N], ans[N];
vector<int> a[N];
void dfs(int u, int par) {
  if (a[u].size() == 1) {
    ans[u] = 1;
    len[u] = 1;
    return;
  }
  len[u] = k + 1;
  for (int i = 0; i < a[u].size(); ++i) {
    int v = a[u][i];
    if (v == par) continue;
    dfs(v, u);
    ans[u] += ans[v];
    if (len[u] + len[v] <= k) {
      ans[u]--;
      len[u] = max(len[u], len[v]);
    } else
      len[u] = min(len[u], len[v]);
  }
  len[u]++;
}
int main() {
  scanf("%d%d", &n, &k);
  for (int i = 1; i < n; ++i) {
    scanf("%d%d", &x, &y);
    a[x].push_back(y);
    a[y].push_back(x);
  }
  int root = 1;
  for (int i = 1; i <= n; ++i)
    if (a[i].size() > 1) root = i;
  dfs(root, root);
  cout << ans[root];
}
