#include <cstdio>
#include <cstring>
#include <ctime>
#include <cstdlib>
#include <cmath>
#include <iostream>
#include <string>
#include <queue>
#include <map>
#include <stack>
#include <vector>
#include <algorithm>
#include <set>
#include <deque>
#include <utility>
#include <chrono>
#include <sstream>
#include <iomanip>
#include <functional>
#include <cassert>

#define INF 1 << 30
#define MOD 1000000007;
#define PI 3.14159265358979
#define rep(i, n) for (int (i) = 0; (i) < (int)(n); (i)++)
#define reu(i, l, r) for (int (i) = (int)(l); (i) < (int)(r); (i)++)
#define D(x) cout << x << endl
#define d(x) cout << x
#define all(x) (x).begin(), (x).end()
#define pub(x) push_back(x)
#define pob() pop_back()
#define puf(x) push_front(x)
#define pof() pop_front()
#define mp(x, y) make_pair((x), (y))
#define fi first
#define se second

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<long long> vll;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef pair<int, int> pii;
typedef pair<long, long> pll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
template<typename T, typename U> inline void amin(T &x, U y) { if (y < x) x = y; }
template<typename T, typename U> inline void amax(T &x, U y) { if (x < y) x = y; }

static const int dx[] = {0, 0, 1, -1};
static const int dy[] = {-1, 1, 0, 0};

int n, k;
vector<vi> e(2020);

int dfs(int x, int p, int d) {
        int ans = 1;
        if (d < k / 2) {
                for (int y : e[x]) {
                        if (y == p) {
                                continue;
                        }
                        ans += dfs(y, x, d + 1);
                }
        }
        return ans;
}

vector<int> Centroid(int root, const vector<vector<int>> &g, const vector<bool> &dead) {
        static vector<int> sz(g.size());
        int alive_cnt = 0;
        function<void (int, int)> count_alive = [&](int u, int prev) {
                alive_cnt ++;
                for (auto v : g[u]) if (v != prev && !dead[v]) {
                        count_alive(v, u);
                }
        };
        count_alive(root, -1);
        vector<int> centroid;
        function<void (int, int)> dfs = [&](int u, int prev) {
                sz[u] = 1;
                bool is_centroid = true;
                for (auto v : g[u]) if (v != prev && !dead[v]) {
                        dfs(v, u);
                        sz[u] += sz[v];
                        if (sz[v] > alive_cnt / 2) is_centroid = false;
                }
                if (alive_cnt - sz[u] > alive_cnt / 2) is_centroid = false;
                if (is_centroid) centroid.push_back(u);
        };
        dfs(root, -1);
        return centroid;
}

int OneCentroid(int root, const vector<vector<int>> &g, const vector<bool> &dead) {
        static vector<int> sz(g.size()); //caution
        function<void (int, int)> get_sz = [&](int u, int prev) {
                sz[u] = 1;
                for (auto v : g[u]) if (v != prev && !dead[v]) {
                        get_sz(v, u);
                        sz[u] += sz[v];
                }
        };
        get_sz(root, -1);
        int n = sz[root];
        function<int (int, int)> dfs = [&](int u, int prev) {
                for (auto v : g[u]) if (v != prev && !dead[v]) {
                        if (sz[v] > n / 2) {
                                return dfs(v, u);
                        }
                }
                return u;
        };
        return dfs(root, -1);
}

int main() {
        cin >> n >> k;
        vector<vector<int>> g(n);
        rep(i, n - 1) {
                int a, b;
                cin >> a >> b, -- a, -- b;
                e[a].pub(b);
                e[b].pub(a);
                g[a].push_back(b);
                g[b].push_back(a);
        }
        vector<bool> dead(n);
        vector<int> centroids = Centroid(0, g, dead);
        int c = OneCentroid(0, g, dead);
        assert(c == centroids[0] || c == centroids[1]);

        int ans = 0;
        if (k & 1) {
                rep(i, n) {
                        for (int j : e[i]) {
                                amax(ans, dfs(i, j, 0) + dfs(j, i, 0));
                        }
                }
        } else {
                rep(i, n) {
                        amax(ans, dfs(i, -1, 0)); 
                }
        }
        D(n - ans);
        return 0;
}


Measured memory_bytes: 640