#include<bits/stdc++.h>
using namespace std;
const int N = 2e3+5;
vector<int> adj[N];
int rt = INT_MAX, n, k, c1, c2, d1, d2;
bitset<N> B1, B2;
bool f;
void DFS(int u, int p, int d, bitset<N> &ah) { if(d>k) ah[u] = 1; for(int x:adj[u]) if(x^p) DFS(x, u, d+1, ah); }
int main(){
    scanf("%d %d", &n, &k);
    for(int i=1;i<n;i++){
        int a, b; scanf("%d %d", &a, &b);
        adj[a].push_back(b);
        adj[b].push_back(a);
    }
    f = k&1;
    k>>=1;
    for(int i=1;i<=n;i++) for(int j:adj[i]){
        B1.reset(); B2.reset();
        DFS(i, 0, 0, B1);
        if(f) DFS(j, 0, 0, B2);
        else DFS(i, 0, 0, B2);
        B1 &= B2;
        rt = min(rt, (int)B1.count());
    }
    printf("%d", rt);
}