#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <deque>
#include <numeric>
#include <bitset>
#include <iomanip>
#include <cassert>
#include <chrono>
#include <random>
#include <limits>
#include <iterator>
#include <functional>
#include <sstream>
#include <complex>
#include <cstring>
using namespace std;

using ll = long long;
using P = pair<int, int>;
constexpr int INF = 1001001001;
constexpr int mod = 1000000007;
// constexpr int mod = 998244353;

template<class T>
inline bool chmax(T& x, T y){
    if(x < y){
        x = y;
        return true;
    }
    return false;
}
template<class T>
inline bool chmin(T& x, T y){
    if(x > y){
        x = y;
        return true;
    }
    return false;
}

template<typename T>
struct CumulativeSum2D{
    vector<vector<T>> data;

    CumulativeSum2D(int W, int H) : data(W + 1, vector<T>(H + 1, 0)) {}

    void add(int x, int y, T z){
        ++x, ++y;
        if(x >= data.size() || y >= data[0].size()) return;
        data[x][y] += z;
    }

    void build(){
        for(int i = 1; i < (int)data.size(); ++i){
            for(int j = 1; j < (int)data[i].size(); ++j){
                data[i][j] += data[i][j - 1] + data[i - 1][j] - data[i - 1][j - 1];
            }
        }
    }

    T query(int sx, int sy, int gx, int gy){
        return (data[gx][gy] - data[sx][gy] - data[gx][sy] + data[sx][sy]);
    }
};

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int N, K;
    cin >> N >> K;
    vector<vector<int>> graph(N);
    vector<P> es;
    for(int i = 0; i < N - 1; ++i){
        int A, B;
        cin >> A >> B;
        --A, --B;
        graph[A].emplace_back(B);
        graph[B].emplace_back(A);
        es.emplace_back(A, B);
    }
    if(K & 1){
        vector<int> dist(N);
        auto dfs = [&](auto&& self, int from, int d, int ban, int par = -1) -> void {
            dist[from] = d;
            for(int to : graph[from]){
                if(to == par || to == ban)  continue;
                self(self, to, d + 1, ban, from);
            }
        };
        int ans = INF;
        int bound = (K - 1) / 2;
        for(auto& p : es){
            int u = p.first, v = p.second;
            dfs(dfs, u, 0, v);
            dfs(dfs, v, 0, u);
            int count = 0;
            for(int i = 0; i < N; ++i){
                if(dist[i] > bound) ++count;
            }
            chmin(ans, count);
        }
        cout << ans << '\n';
    }
    else{
        vector<int> dist(N);
        auto dfs = [&](auto&& self, int from, int d = 0, int par = -1) -> void {
            dist[from] = d;
            for(int to : graph[from]){
                if(to == par)   continue;
                self(self, to, d + 1, from);
            }
        };
        int ans = INF;
        int bound = K / 2;
        for(int v = 0; v < N; ++v){
            dfs(dfs, v);
            int count = 0;
            for(int i = 0; i < N; ++i){
                if(dist[i] > bound) ++count;
            }
            chmin(ans, count);
        }
        cout << ans << '\n';
    }
}

Measured memory_bytes: 3920