#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2010;
vector <int> adj[MAXN];
bitset <MAXN> b;
int k, limit;
int dfs(int v, int l) {
    if (l > limit || b[v])
        return 0;
    b[v] = true;
    int res = 1;
    for (auto i : adj[v])
        res += dfs(i, l + 1);
    b[v] = false;
    return res;
}
int main () {
    int n, k, a1, a2;
    cin >> n >> k;
    for (int i = 1; i < n; ++i) {
        cin >> a1 >> a2;
        adj[a1].push_back(a2);
        adj[a2].push_back(a1);
    }
    if (k % 2 == 0) {
        limit = k / 2;
        int res = 0;
        for (int i = 1; i <= n; ++i)
            res = max(res, dfs(i, 0));
        return cout << n - res, 0;
    }
    limit = k / 2;
    int res = 0;
    for (int v = 1; v <= n; ++v)
        for (auto i : adj[v]) {
            b[i] = true;
            int cnt = dfs(v, 0);
            b[i] = false;
            b[v] = true;
            cnt += dfs(i, 0);
            b[v] = false;
            res = max(res, cnt);
        }
    cout << n - res;
    return 0;
}