import std.algorithm;
import std.stdio;

immutable int NA = -1;

void main ()
{
	int n, k;
	while (readf (" %s %s", &n, &k) > 0)
	{
		auto a = new int [] [n];
		foreach (i; 0..n - 1)
		{
			int u, v;
			readf (" %s %s", &u, &v);
			u--;
			v--;
			a[u] ~= v;
			a[v] ~= u;
		}

		int res = 0;
		int add = 0;
		auto b = new bool [n];

		void recur (int v, int p, int d)
		{
			if (d < 0)
			{
				return;
			}

			b[v] = true;
			int c = 0;
			foreach (u; a[v])
			{
				if (u != p)
				{
					c += 1;
					recur (u, v, d - 1);
				}
			}

			if (d == 0)
			{
				add = max (add, c);
			}
		}

		foreach (i; 0..n)
		{
			b[] = false;
			add = 0;
			recur (i, NA, k / 2);
			res = max (res, sum (b) + (k & 1) * add);
		}

		if (k == 1)
		{
			res = 2;
		}

		writeln (n - res);
	}
}
