import std.stdio;
import std.conv, std.array, std.algorithm, std.string;
import std.math, std.random, std.range;
import std.bigint;

class Node{
	Edge[] edges;
	int id;
	int flag;
	this(int i){
		this.id = i;
		}
	void add(Edge e){
		edges ~= e;
		}
	}
class Edge{
	Node[] nodes;
	this(Node n1, Node n2){
		this.nodes = [n1, n2];
		n1.add(this);
		n2.add(this);
		}
	}

void main(){
	
	int[] ins = readln.chomp.split.map!(to!int).array;
	
	int n = ins[0], k = ins[1];
	
	Edge[] edges;
	Node[] nodes;
	foreach(i; 0 .. n) nodes ~= new Node(i);
	for(int i = 0; i < n - 1; i ++){
		int[] ab = readln.chomp.split.map!(to!int).map!(a => a - 1).array;
		edges ~= new Edge(nodes[ab[0]], nodes[ab[1]]);
		}
	
	
	int ans;
	
	int getCnt(Node[] ns0, int r){ // count of nodes within radius r
		foreach(n2; nodes) n2.flag = 0;
		int cnt;
		foreach(n0; ns0) n0.flag = 1;
		Node[] ns1 = ns0;
		for(int d = 0; d <= r; d ++){
			cnt += ns1.length;
			Node[] ns2;
			foreach(n1; ns1){
				foreach(e; n1.edges){
					foreach(n2; e.nodes){
						if(!n2.flag) n2.flag = 1, ns2 ~= n2;
						}
					}
				}
			ns1 = ns2;
			}
		return cnt;
		}
	
	if(k % 2 == 0){
		int max = 0;
		int r = k / 2;
		foreach(n0; nodes){ // center node
			int cnt = getCnt([n0], r);
			if(cnt > max) max = cnt;
			}
		ans = n - max;
		}
	else{ // center edge
		int max = 0;
		int r = k / 2;
		foreach(e0; edges){
			int cnt = getCnt(e0.nodes, r);
			if(cnt > max) max = cnt;
			}
		ans = n - max;
		}
	
	ans.writeln;
	
	}
