import java.io.*;
import java.util.*;

public class cockroach_ak {
	int n, c;

	HashSet<Integer>[] g;
	int[] p;
	boolean[] used;

	int[] used2;
	int iteration = 1;

	static class DSU {
		int[] p;

		public DSU(int n) {
			p = new int[n];
			for (int i = 0; i < n; i++) {
				p[i] = i;
			}
		}

		int get(int v) {
			return p[v] != v ? p[v] = get(p[v]) : v;
		}

		void union(int v1, int v2) {
			p[get(v1)] = get(v2);
		}
	}

	int parent;
	void dfs1(int v) {
		used[v] = true;
		p[v] = parent;
//		if (v % 123 == 0) System.err.println(v);
		for (int to : g[v]) {
			if (!used[to]) {
				parent = v;
				dfs1(to);	
			}							
		}
	}

	static class State implements Comparable<State> {
		int l, n;

		public State(int l, int n) {
			this.l = l;
			this.n = n;
		}

		@Override
		public int compareTo(State o) {
			return o.l - l;
		}

		@Override
		public String toString() {
			return "<" + n + ": " + l + ">";
		}
	}

	ArrayList<State> states;

	void dfs2(int v, int d) {
		states.add(new State(d, v));
		for (int to : g[v]) {
			dfs2(to, d + 1);
		}
	}

	void dfs3(int v, int remain) {
		used2[v] = iteration;
		used[v] = true;
		if (remain == 0)
			return;
		for (int to : g[v]) {
			if (used2[to] != iteration)
				dfs3(to, remain - 1);
		}
		if (used2[p[v]] != iteration)
			dfs3(p[v], remain - 1);
	}

	@SuppressWarnings("unchecked")
	void run() throws FileNotFoundException {
		Scanner in = new Scanner(new File("cockroach.in"));
		PrintWriter out = new PrintWriter("cockroach.out");
		n = in.nextInt();
		DSU dsu = new DSU(n);
		c = in.nextInt();
		g = new HashSet[n];
		for (int i = 0; i < n; i++) {
			g[i] = new HashSet<Integer>();
		}
		for (int i = 0; i < n - 1; i++) {
			int f = in.nextInt() - 1;
			int t = in.nextInt() - 1;
			dsu.union(f, t);
			g[f].add(t);
			g[t].add(f);
		}

		for (int i = 0; i < n; i++) {
			if (dsu.get(i) != dsu.get(0))
				throw new AssertionError();
		}
		
		used = new boolean[n];
		p = new int[n];
		dfs1(0);

		for (int i = 0; i < n; i++) {
			g[i].remove(p[i]);
		}

		states = new ArrayList<State>();
		dfs2(0, 0);

		Collections.sort(states);
		used = new boolean[n];
		used2 = new int[n];
		int ans = 0;
		for (State s : states) {
			if (!used[s.n]) {
				int to = s.n;
				for (int i = 0; i < c; i++) {
					to = p[to];
				}
				iteration++;
				ans++;
//				System.err.println(to);
				dfs3(to, c);
			}
		}

		out.println(ans);
		out.close();
	}

	public static void main(String[] args) throws FileNotFoundException {
		new cockroach_ak().run();
	}
}
