#include <bits/stdc++.h>
using namespace std;
const int maxn = 1000010;
vector<int> G[maxn];
int N, K, ans;
int dfs(int u, int f) {
  if (G[u].size() == 1) return 0;
  vector<int> cur;
  int sz = G[u].size();
  for (int i = 0; i < sz; i++)
    if (G[u][i] != f) cur.push_back(dfs(G[u][i], u) + 1);
  sort(cur.begin(), cur.end());
  while ((sz = cur.size()) >= 2) {
    if (cur[sz - 1] + cur[sz - 2] <= K) break;
    ans++;
    cur.pop_back();
  }
  return cur.back();
}
int main() {
  int u, v;
  scanf("%d%d", &N, &K);
  for (int i = 1; i <= N - 1; i++) {
    scanf("%d%d", &u, &v);
    G[u].push_back(v);
    G[v].push_back(u);
  }
  for (int i = 1; i <= N; i++) {
    if (G[i].size() > 1) {
      dfs(i, -1);
      break;
    }
  }
  printf("%d\n", ans + 1);
  return 0;
}
