#include <bits/stdc++.h>
#include <boost/functional/hash.hpp>

#define debug 0
#define esc(ret) cout << (ret) << endl,quick_exit(0)
#define fcout(d) cout << fixed << setprecision(d)
#define repU(i,s,t) for(int i = (int)(s); i <= (int)(t); ++i)
#define repD(i,s,t) for(int i = (int)(s); i >= (int)(t); --i)
#define rep(i,n) repU(i,0,(n) - 1)
#define rep1(i,n) repU(i,1,(n))
#define all(v) begin(v),end(v)
#define vct vector
#define prique priority_queue
#define l_bnd lower_bound
#define u_bnd upper_bound
#define puf push_front
#define pub push_back
#define pof pop_front
#define pob pop_back
#define mkp make_pair
#define mkt make_tuple
#define ins insert
#define emp emplace
#define era erase
#define fir first
#define sec second
#define odd(x) (x & 1)
#define even(x) (!odd(x))

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef pair<int,int> pii;
typedef pair<db,int> pdi;
typedef tuple<int,int,int> tiii;

const int dir[8][2] = { {1,0},{0,1},{-1,0},{0,-1},{1,1},{-1,1},{-1,-1},{1,-1} };
const ll mod = 1e9 + 7;
const ll inf = (1LL << 62) - 1;

template <class T, class U> T qceil(T x, U y) { return x > 0 ? (x - 1) / y + 1 : x / y; }
template <class T, class U> bool parity(T x, U y) { return odd(x) ^ even(y); }
template <class T, class U> bool chmax(T &m, U x) { if(m < x) { m = x; return 1; } return 0; }
template <class T, class U> bool chmin(T &m, U x) { if(m > x) { m = x; return 1; } return 0; }
template <class T> bool cmprs(T &v) {
    T tmp = v;
    sort(all(tmp));
    tmp.erase(unique(all(tmp)),end(tmp));
    for(auto it = begin(v); it != end(v); ++it) *it = l_bnd(all(tmp),*it) - begin(tmp) + 1;
    return v.size() > tmp.size();
}

int n,k,dist[2010];
vct<int> G[2001];
vct<pii> eg;

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

    cin>>n>>k;
    rep(i,n-1){
      int a,b;
      cin>>a>>b;
      G[a].pub(b),G[b].pub(a);
      eg.pub({a,b});
    }
    ll ans=inf;
    if(odd(k)){
      rep(i,n-1){
        int a=eg[i].fir,b=eg[i].sec;
        queue<pii> q;
        q.push({a,b});
        dist[a]=0;
        int tmp=0;
        while(!q.empty()){
          int f=q.front().fir,l=q.front().sec;
          q.pop();
          for(int i:G[f]){
            if(i!=l){
              dist[i]=dist[f]+1;
              q.push({i,f});
              if(dist[i]>k/2) tmp++;
            }
          }
        }
        q.push({b,a});
        dist[b]=0;
        while(!q.empty()){
          int f=q.front().fir,l=q.front().sec;
          q.pop();
          for(int i:G[f]){
            if(i!=l){
              dist[i]=dist[f]+1;
              q.push({i,f});
              if(dist[i]>k/2) tmp++;
            }
          }
        }
        chmin(ans,tmp);
      }
      esc(ans);
    }else{
      rep1(i,n){
        queue<pii> q;
        q.push({i,0});
        dist[i]=0;
        int tmp=0;
        while(!q.empty()){
          int f=q.front().fir;
          int l=q.front().sec;
          q.pop();
          for(int i:G[f]){
            if(l!=i){
              dist[i]=dist[f]+1;
              if(dist[i]>k/2)tmp++;
              q.push({i,f});
            }
          }
        }
        chmin(ans,tmp);
      }
      esc(ans);
    }
}


Measured memory_bytes: 384