#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <climits>

#define rep(i, m, n) for(int i=int(m);i<int(n);i++)
#define EACH(i, c) for (auto &(i): c)
#define all(c) begin(c),end(c)
#define EXIST(s, e) ((s).find(e)!=(s).end())
#define SORT(c) sort(begin(c),end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())

//#define LOCAL 0
//#ifdef LOCAL
//#define DEBUG(s) cout << (s) << endl
//#define dump(x)  cerr << #x << " = " << (x) << endl
//#define BR cout << endl;
//#else
//#define DEBUG(s) do{}while(0)
//#define dump(x) do{}while(0)
//#define BR
//#endif


//改造
typedef long long int ll;
using namespace std;
#define INF (1 << 20)
#define INFl (ll)5e15
#define DEBUG 0 //デバッグする時1にしてね
#define dump(x)  cerr << #x << " = " << (x) << endl
#define MOD 1000000007
//ここから編集する
vector<int> G[2001];

int main() {
    int n, k;
    cin >> n >> k;
    vector<pair<int, int> > ed;
    rep(i, 0, n - 1) {
        int a, b;
        cin >> a >> b;
        G[a].push_back(b);
        G[b].push_back(a);
        ed.emplace_back(a, b);
    }

    if (k % 2) {
        int d = (k - 1) / 2;
        int ans = n;
        rep(i, 0, ed.size()) {
            queue<pair<int, int> > q;
//            queue<int> q;
            bool used[2001] = {};
            q.emplace(ed[i].first, 0);
            q.emplace(ed[i].second, 0);
            used[ed[i].first] = true;
            used[ed[i].second] = true;
            int cnt = 0;
            while (!q.empty()) {
                vector<int> next = G[q.front().first];
                int dist = q.front().second;
                q.pop();
                if (dist > d) break;
                rep(j, 0, next.size()) {
                    if (!used[next[j]]) {
                        q.emplace(next[j], dist + 1);
                        used[next[j]] = true;
                    }
                }
                cnt++;
            }
            ans = min(ans, n - cnt);
        }
        cout << ans << endl;
        return 0;
    } else {
        int d = k / 2;
        int ans = n;

        rep(i, 0, n) {
            queue<pair<int, int> > q;
//            queue<int> q;
            q.emplace(i, 0);
            bool used[2001] = {};
            used[i] = true;
            int cnt = 0;
            while (!q.empty()) {
                vector<int> next = G[q.front().first];
                int dist = q.front().second;
                q.pop();
                if (dist > d) break;
                rep(j, 0, next.size()) {
                    if (!used[next[j]]) {
                        q.emplace(next[j], dist + 1);
                        used[next[j]] = true;
                    }
                }
                cnt++;
            }
            ans = min(ans, n - cnt);
        }
        cout << ans << endl;
        return 0;
    }


    return 0;
}


Measured memory_bytes: 384