Someone give a strange birthday present to Ivan. It is hedgehog — connected undirected graph in which one vertex has degree at least 3 (we will call it center) and all other vertices has degree 1. Ivan thought that hedgehog is too boring and decided to make himself k-multihedgehog.

Let us define k-multihedgehog as follows:

  * 1-multihedgehog is hedgehog: it has one vertex of degree at least 3 and some vertices of degree 1.
  * For all k ≥ 2, k-multihedgehog is (k-1)-multihedgehog in which the following changes has been made for each vertex v with degree 1: let u be its only neighbor; remove vertex v, create a new hedgehog with center at vertex w and connect vertices u and w with an edge. New hedgehogs can differ from each other and the initial gift. 



Thereby k-multihedgehog is a tree. Ivan made k-multihedgehog but he is not sure that he did not make any mistakes. That is why he asked you to check if his tree is indeed k-multihedgehog.

Input

First line of input contains 2 integers n, k (1 ≤ n ≤ 10^{5}, 1 ≤ k ≤ 10^{9}) — number of vertices and hedgehog parameter.

Next n-1 lines contains two integers u v (1 ≤ u,    v ≤ n;    u ≠ v) — indices of vertices connected by edge.

It is guaranteed that given graph is a tree.

Output

Print "Yes" (without quotes), if given graph is k-multihedgehog, and "No" (without quotes) otherwise.

Examples

Input

14 2
1 4
2 4
3 4
4 13
10 5
11 5
12 5
14 5
5 13
6 7
8 6
13 6
9 6


Output

Yes


Input

3 1
1 3
2 3


Output

No

Note

2-multihedgehog from the first example looks like this:

<image>

Its center is vertex 13. Hedgehogs created on last step are: [4 (center), 1, 2, 3], [6 (center), 7, 8, 9], [5 (center), 10, 11, 12, 13].

Tree from second example is not a hedgehog because degree of center should be at least 3.
import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
import java.util.Queue;
import java.util.StringTokenizer;


public class Main {

	static class Task {
		
		int NN = 300005;
		int MOD = 1000000007;
		int INF = 2009000000;
		long INFINITY = 2000000000000000000L;
		
		List<Integer> [] g;

		public void solve(InputReader in, PrintWriter out) {
			int n= in.nextInt();
			rank = new int[n + 1];
			int k= in.nextInt();
			g = new ArrayList[n + 1];
			for(int i=1;i<=n;++i) {
				g[i] = new ArrayList<>();
				rank[i] = -1;
			}
			for(int i=1;i<n;++i) {
				int u = in.nextInt();
				int v = in.nextInt();
				g[u].add(v);
				g[v].add(u);
			}
			Queue<Integer> q = new LinkedList<>();
			getLeaves(n).stream().forEach(e->{
				q.add(e);rank[e] = 0;
			});
			processed = new boolean[n + 1];
			Arrays.fill(processed, false);
			int maxK = 0;
			int root = -1;
			while(!q.isEmpty()) {
				int x = q.poll();
				processed[x] = true;
				int y =  getUnprocessed(x);
				while(y != -1 && g[y].size() < 3) {
					processed[y] = true;
					y = getUnprocessed(y);
				}
				if(y == -1)
					continue;
				if(rank[y] != -1) {
					if (rank[y] != rank[x] + 1) {
						out.println("No");return;								
					}					
				} else {
					rank[y] = rank[x] + 1;
					if(rank[y] > maxK) {
						maxK = rank[y];
						root = y;
					}
					q.add(y);
				}
			}
			for(int i=1;i<=n;++i) {
				if(rank[i] > 0 && rank[i] < maxK) {
					if(g[i].size() <= 3) {
						out.println("No");return;
					}
				}
			}
			if(maxK == k) {
				if(dfs(root, -1, maxK) == maxK) {
					out.println("Yes");
				} else {
					out.println("No");	
				}
			} else {
				out.println("No");
			}
		}
		
		int dfs(int x, int px, int currentRank) {
			int r = -1;
			for(int y: g[x]) {
				if(y == px)
					continue;
				r = dfs(y, x, rank[y] == -1 ? currentRank: rank[y]);
				if(currentRank-1 != r)
					return -1;
			}
			return currentRank;				
		}
		
		int getUnprocessed(int x) {
			for(int e: g[x]) {
				if(processed[e])
					continue;
				return e;
			}
			return -1;
		}
		
		boolean [] processed;
		int [] rank;
		
		List<Integer> getLeaves(int n){
			List<Integer> r = new ArrayList<>();
			for(int i=1;i<=n;++i) {
				if(g[i].size() == 1) {
					r.add(i);
				}
			}
			return r;
		}
		
	}
	
	static void prepareIO(boolean isFileIO) {
		//long t1 = System.currentTimeMillis();
		Task solver = new Task();
		// Standard IO
		if(!isFileIO) { 
			InputStream inputStream = System.in;
	        OutputStream outputStream = System.out;
	        InputReader in = new InputReader(inputStream);
	        PrintWriter out = new PrintWriter(outputStream);
	        solver.solve(in, out);
	        //out.println("time(s): " + (1.0*(System.currentTimeMillis()-t1))/1000.0);
	        out.close();
		}
        // File IO
		else {
			String IPfilePath = System.getProperty("user.home") + "/Downloads/ip.in";
	        String OPfilePath = System.getProperty("user.home") + "/Downloads/op.out";
	        InputReader fin = new InputReader(IPfilePath);
	        PrintWriter fout = null;
	        try {
				fout = new PrintWriter(new File(OPfilePath));
			} catch (FileNotFoundException e) {
				e.printStackTrace();
			}
	        solver.solve(fin, fout);
	        //fout.println("time(s): " + (1.0*(System.currentTimeMillis()-t1))/1000.0);
	        fout.close();
		}
	}
	
	public static void main(String[] args) {
        prepareIO(false);
	}
	
	static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }
        
        public InputReader(String filePath) {
        	File file = new File(filePath);
            try {
				reader = new BufferedReader(new FileReader(file));
			} catch (FileNotFoundException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
            tokenizer = null;
        }
        
        public String nextLine() {
        	String str = "";
        	try {
				str = reader.readLine();
			} catch (IOException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
        	return str;
        }
        
        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

        public double nextDouble() {
        	return Double.parseDouble(next());
        }
        
    }

}