#include <bits/stdc++.h>
using namespace std;
const long double eps = 1e-13;
const long double PI = acos(-1);
const int INF = (int)1e9;
const long long INFF = (long long)1e18;
const int mod = (int)1e9 + 7;
const int MXN = (int)1e6 + 7;
int n, k;
int ans = 1;
vector<int> edge[MXN];
int dfs(int u, int pa) {
  vector<int> buf;
  if ((int)(edge[u]).size() == 1) return 0;
  for (int v : edge[u]) {
    if (v == pa) continue;
    int d = dfs(v, u) + 1;
    buf.push_back(d);
  }
  sort(begin(buf), end(buf));
  while ((int)(buf).size() >= 2) {
    if (buf.back() + buf[(int)(buf).size() - 2] <= k) break;
    ans++;
    buf.pop_back();
  }
  return buf.back();
}
int main(void) {
  scanf("%d %d", &n, &k);
  for (int i = 1; i < n; ++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 + 1; ++i)
    if ((int)(edge[i]).size() >= 2) {
      dfs(i, 0);
      break;
    }
  printf("%d\n", ans);
  return 0;
}
