#include <bits/stdc++.h>
using namespace std;
int vis[(1000000 + 5)], n, k, rt;
int ans = 0;
vector<int> edge[(1000000 + 5)];
int dfs(int u) {
  vis[u] = 1;
  if (edge[u].size() == 1) return 0;
  vector<int> v;
  for (int i = 0; i < edge[u].size(); i++) {
    int now = edge[u][i];
    if (!vis[now]) {
      v.push_back(dfs(now) + 1);
    }
  }
  sort(v.begin(), v.end());
  while (v.size() > 1) {
    int sz = v.size();
    if (v[sz - 1] + v[sz - 2] <= k)
      break;
    else {
      ans++;
      v.pop_back();
    }
  }
  return v.back();
}
int main() {
  scanf("%d%d", &n, &k);
  for (int i = 1; i <= n - 1; i++) {
    int u, v;
    scanf("%d%d", &u, &v);
    edge[u].push_back(v);
    edge[v].push_back(u);
  }
  for (int i = 1; i <= n; i++) {
    if (edge[i].size() > 1) {
      rt = i;
      break;
    }
  }
  dfs(rt);
  printf("%d", ans + 1);
  return 0;
}
