#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES

#include "bits/stdc++.h"

#define REP(i,a,b) for(int i=a;i<b;++i)
#define rep(i,n) REP(i,0,n)
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define all(a) begin(a),end(a)
#define ifnot(a) if(not (a))
#define dump(x)  cerr << #x << " = " << (x) << endl
using namespace std;

// #define int ll

int dx[] = { 0,1,0,-1 };
int dy[] = { 1,0,-1,0 };
#define LINF ((ll)1 << 60)
#define INF (1 << 28)
template<typename T>
void chmax(T& a, T b) {
        if (a < b) a = b;
}
template<typename T>
void chmin(T& a,T b) {
        if (a > b) a = b;
}
bool debug = false;
//.....................
ull mod = (int)1e9 + 7;
const int MAX = (int)2e5 + 5;

ll N, K;
vector<vector<int>> connect;
vector<bool> visited;

struct Point {
        int id, cnt;
};

// int remove_cnt(int now, int cnt) {
//      visited[v] = true;
//      int tmp = cnt > K;
//      for (auto& v : connect[now]) {
//              if (not visited[v]) {
//                      int tmp2 = dfs(v, cnt+1);
//                      tmp += tmp2;
//              }
//      }
//      return tmp;
// }

int remove_cnt(int start1, int start2) {
        queue<Point> q;
        visited[start1] = true;
        q.push({start1, 0});
        if (start2 != -1) {
                visited[start2] = true;
                q.push({start2, 0});
        }
        int tmp = 0;
        while (q.size() > 0) {
                Point now = q.front(); q.pop();
                // dump(now.cnt);
                if (now.cnt > K / 2) tmp++;
                for (auto v : connect[now.id]) {
                        if (not visited[v]) {
                                visited[v] = true;
                                q.push({v, now.cnt + 1});
                        }
                }
        }
        return tmp;
}

int ans() {
        int tmp = INT_MAX;
        if (K % 2 == 0) {
                rep(i, N) {
                        visited.resize(2005);
                        rep(i, N) visited[i] = false;
                        int tmp2 = remove_cnt(i, -1);
                        dump(tmp2);
                        chmin(tmp, tmp2);
                }
        }
        else {
                rep(i, N) {
                        for (auto v : connect[i]) {
                                visited.resize(2005);
                                rep(i, N) visited[i] = false;
                                int tmp2 = remove_cnt(i, v);
                                chmin(tmp, tmp2);
                        }
                }
        }
        return tmp;
}


void solve() {
        cin >> N >> K;
        connect.resize(N);
        rep(i, N-1) {
                int a, b;
                cin >> a >> b;
                a--; b--;
                connect[a].push_back(b);
                connect[b].push_back(a);
        }
        cout << ans() << endl;
}

signed main(int argc, char *argv[]) {
        int T = 1;
        cout << fixed << setprecision(20);
        rep(i, argc) {
                if (argv[i] == "-debug"s) {
                        debug = true;
                }
        }
        rep(i, T) {
                solve();
        }
        return 0;
}

Measured memory_bytes: 384