#include <bits/stdc++.h>
using namespace std;
const int NN = 1272727;
using pii = pair<int, int>;
int k;
vector<int> adj[NN];
multiset<int> IN[NN];
int deep[NN];
void dfs(int u, int fa = 0) {
  deep[u] = deep[fa] + 1;
  for (int v : adj[u])
    if (v != fa) dfs(v, u);
  int id, mx = 0;
  if (adj[u].size() == 1) {
    IN[u].insert(deep[u]);
    return;
  }
  for (int v : adj[u])
    if (v != fa) {
      if (IN[v].size() > mx) mx = IN[v].size(), id = v;
    }
  swap(IN[u], IN[id]);
  for (int v : adj[u])
    if (v != fa) {
      for (int w : IN[v]) IN[u].insert(w);
      IN[v].clear();
    }
  while (IN[u].size() > 1) {
    int p = *IN[u].begin();
    IN[u].erase(IN[u].begin());
    int q = *IN[u].begin();
    if (p + q - 2 * deep[u] <= k) continue;
    IN[u].insert(p);
    break;
  }
}
int main() {
  int n, root;
  scanf("%d%d", &n, &k);
  for (int i = 1; i < n; i++) {
    int u, v;
    scanf("%d%d", &u, &v);
    adj[u].push_back(v);
    adj[v].push_back(u);
  }
  for (int i = 1; i <= n; i++)
    if (adj[i].size() > 1) {
      root = i;
      break;
    }
  dfs(root);
  cout << IN[root].size() << endl;
  return 0;
}
