#include <bits/stdc++.h>
using namespace std;
char ibuf[1 << 25], *ih = ibuf;
inline void read(int& x) {
  for (; !isdigit(*ih); ++ih)
    ;
  for (x = 0; isdigit(*ih); x = x * 10 + *ih++ - 48)
    ;
}
const int N = 1000005;
int t[N << 2];
inline int Max(const int& a, const int& b) { return a < b ? b : a; }
int u, v, i, n, k;
int lcnt, dl[N], dep[N], le[N], ri[N], dfn[N], xb, dad[N], ans;
vector<int> e[N];
int g[N], cc[N];
void dfs(int x, int fa) {
  dep[x] = dep[fa] + 1;
  dad[x] = fa;
  int ccnt = 0;
  for (int i = 0; i < e[x].size(); ++i) ccnt += e[x][i] != fa;
  le[x] = lcnt + 1;
  if (e[x].size() == 1) dl[++lcnt] = dep[x];
  for (int i = 0; i < e[x].size(); ++i)
    if (e[x][i] != fa) dfs(e[x][i], x);
  if (ccnt > 1)
    g[x] = x;
  else
    g[x] = fa;
  cc[x] = ccnt;
  ri[x] = lcnt;
  dfn[++xb] = x;
}
inline int gfa(int x) { return g[x] == x ? x : g[x] = gfa(g[x]); }
void build(int i, int l, int r) {
  if (l == r) {
    t[i] = dl[l];
    return;
  }
  int m = (l + r) >> 1;
  build(i << 1, l, m);
  build(i << 1 | 1, m + 1, r);
  t[i] = Max(t[i << 1], t[i << 1 | 1]);
}
int query(int i, int l, int r, int x, int y) {
  if (!t[i] || (l == x && r == y)) return t[i];
  int m = (l + r) >> 1;
  if (x > m)
    return query(i << 1 | 1, m + 1, r, x, y);
  else if (y <= m)
    return query(i << 1, l, m, x, y);
  else
    return Max(query(i << 1, l, m, x, m),
               query(i << 1 | 1, m + 1, r, m + 1, y));
}
void mdy(int i, int l, int r, int x, int y) {
  if (l == x && r == y) {
    t[i] = 0;
    return;
  }
  int m = (l + r) >> 1;
  if (x > m)
    mdy(i << 1 | 1, m + 1, r, x, y);
  else if (y <= m)
    mdy(i << 1, l, m, x, y);
  else
    mdy(i << 1, l, m, x, m), mdy(i << 1 | 1, m + 1, r, m + 1, y);
  t[i] = Max(t[i << 1], t[i << 1 | 1]);
}
vector<pair<int, int> > zz[N];
bool cmpp(const int& x, const int& y) { return dep[x] > dep[y]; }
int main() {
  fread(ibuf, 1, 1 << 25, stdin);
  read(n);
  read(k);
  for (i = 1; i < n; ++i) {
    read(u);
    read(v);
    e[u].push_back(v);
    e[v].push_back(u);
  }
  for (i = 1; i <= n; ++i)
    if (e[i].size() > 1) break;
  dfs(i, 0);
  build(1, 1, lcnt);
  ans = 1;
  sort(dfn + 1, dfn + xb + 1, cmpp);
  for (i = 1; i <= xb; ++i) {
    u = dfn[i];
    if (u == 10) {
      ++u, --u;
    }
    int gg = gfa(dad[u]);
    gg = u;
    if (zz[gg].empty()) {
      int j;
      for (j = 0; j < e[gg].size(); ++j)
        if (e[gg][j] != dad[gg])
          zz[gg].push_back(make_pair(
              query(1, 1, lcnt, le[e[gg][j]], ri[e[gg][j]]), e[gg][j]));
      sort(zz[gg].begin(), zz[gg].end());
      for (; zz[gg].size() > 1;) {
        int l = zz[gg].size() - 1, uu = zz[gg][l].first,
            vv = zz[gg][l - 1].first;
        if (uu + vv - 2 * dep[gg] <= k) break;
        u = zz[gg].back().second;
        mdy(1, 1, lcnt, le[u], ri[u]);
        zz[gg].pop_back();
        ++ans;
      }
    }
  }
  printf("%d\n", ans);
  return 0;
}
