#include <algorithm>
#include <iostream>
#include <vector>
#include <math.h>
#include <set>
#include <map>
#include <string>
#include <stack>
#include <queue>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <bitset>
#include <complex>
#include <unistd.h>
#include <cassert>
#include <cctype>
#include <random>
#define _USE_MATH_DEFINES
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> plglg;
typedef tuple<int, int, int> tiii;
typedef tuple<ll, ll, ll> tlglglg;
typedef complex<double> xy_t;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
double pi = 3.141592653589793;
ll mod = 1000000007;
int intmax = 2147483647;
int intmin = -2147483648;
ll llmax = 9223372036854775807;
ll llmin = -9223372036854775807;
ll inf = llmax / 2;
double eps = 1e-11;

struct edge {
    int to, cost;
};

int V;
vector<edge> G[1000000];
bool gsub[2010][2010];
ll d[1000000];

plglg visit(int v) {
    plglg ans(0, v);
    queue<tlglglg> que;
    tlglglg start(-1, v, 0);
    d[v] = 0;
    que.push(start);
    while (que.size() > 0) {
        tlglglg p;
        p = que.front();
        que.pop();
        ll back = get<0>(p);
        ll now = get<1>(p);
        ll weight = get<2>(p);
        int n = G[now].size();
        for (int i = 0; i < n; i++) {
            edge e = G[now][i];
            if (e.to != back && gsub[now][e.to]) {
                tlglglg pp(now, e.to, weight + e.cost);
                que.push(pp);
                d[e.to] = weight + e.cost;
                if (weight + e.cost > ans.first) {
                    ans.first = weight + e.cost;
                    ans.second = e.to;
                }
            }
        }
    }
    return ans;
}

pii farthest;
vector<int> diam;

int K;

ll diameter() {
    plglg r = visit(0);
    plglg t = visit(r.second);
    farthest.first = r.second;
    farthest.second = t.second;
    int now = t.second;
    diam.push_back(now);
    ll nowdis = t.first;
    for (int i = 0; i < t.first; i++) {
        int s = G[now].size();
        for (int j = 0; j < s; j++) {
            if (d[G[now][j].to] == nowdis - G[now][j].cost && gsub[t.second][G[now][j].to]) {
                nowdis -= G[now][j].cost;
                now = G[now][j].to;
                diam.push_back(now);
                break;
            }
        }
    }
    return t.first;
}

int bfs(int n, int v, int u) {
    fill(d, d + V, -1);
    int ans = 0;
    d[v] = 0;
    queue<pii> que;
    que.push(pii(0, v));
    ans++;
    if (n == 2) {
        d[u] = 0;
        que.push(pii(0, u));
        ans++;
    }
    while (!que.empty()) {
        pii p = que.front();
        que.pop();
        int dis = p.first;
        int vtx = p.second;
        if (p.first < K / 2) {
            int len = G[vtx].size();
            for (int i = 0; i < len; i++) {
                if (d[G[vtx][i].to] == -1) {
                    d[G[vtx][i].to] = dis + 1;
                    que.push(pii(d[G[vtx][i].to], G[vtx][i].to));
                    ans++;
                }
            }
        }
    }
    return ans;
}

vector<pii> ed;

int main() {
    int N;
    cin >> N >> K;
    V = N;
    for (int i = 0; i < 2010; i++) {
        fill(gsub[i], gsub[i] + 2010, false);
    }
    for (int i = 0; i < N - 1; i++) {
        int a, b;
        cin >> a >> b;
        edge e1;
        e1.to = a - 1;
        e1.cost = 1;
        G[b - 1].push_back(e1);
        gsub[a - 1][b - 1] = true;
        edge e2;
        e2.to = b - 1;
        e2.cost = 1;
        G[a - 1].push_back(e2);
        gsub[b - 1][a - 1] = true;
        ed.push_back(pii(a - 1, b - 1));
    }
    ll ans = llmax;
    if (K % 2 == 0) {
        for (int i = 0; i < N; i++) {
            int p = bfs(1, i, -1);
            if (N - p < ans) {
                ans = N - p;
            }
        }
    } else {
        int len = ed.size();
        for (int i = 0; i < len; i++) {
            pii q = ed[i];
            int p = bfs(2, q.first, q.second);
            if (N - p < ans) {
                ans = N - p;
            }
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 29440