#include <bits/stdc++.h>
using namespace std;
const int INF = 1000000000 + 7;
const long long LL_INF = 1ll * INF * INF;
const int MAX_N = 1000000 + 7;
const int mod = INF;
template <typename T>
inline void addmod(T& a, const long long& b, const int& MOD) {
  a = (a + b) % MOD;
  if (a < 0) a += MOD;
}
int n, k;
vector<int> adj[MAX_N];
int depth[MAX_N];
int max_depth[MAX_N];
int f[MAX_N];
void dfs(int u, int r) {
  if (r != -1) depth[u] = depth[r] + 1;
  max_depth[u] = depth[u];
  for (int v : adj[u])
    if (v != r) {
      dfs(v, u);
      max_depth[u] = max(max_depth[u], max_depth[v]);
      f[u] += f[v];
    }
  if (max_depth[u] == depth[u]) {
    f[u] = 1;
    return;
  }
  vector<int> temp;
  for (int v : adj[u])
    if (v != r) {
      temp.push_back(max_depth[v]);
    }
  sort(temp.begin(), temp.end());
  int& last = max_depth[u];
  for (int i = 1; i < temp.size(); ++i) {
    if (temp[i - 1] + temp[i] - 2 * depth[u] <= k) {
      --f[u];
    } else
      last = min(last, temp[i - 1]);
  }
  last = min(last, temp.back());
}
void solve() {
  cin >> n >> k;
  for (int i = (1), _b = (n); i < _b; ++i) {
    int u, v;
    cin >> u >> v;
    adj[u].push_back(v);
    adj[v].push_back(u);
  }
  int root = 1;
  while (adj[root].size() == 1) ++root;
  dfs(root, -1);
  cout << f[root];
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  const bool multiple_test = false;
  int test = 1;
  if (multiple_test) cin >> test;
  for (int i = 0; i < test; ++i) {
    solve();
  }
}
