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.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
import java.io.PrintWriter;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Queue;
public class B1067 
{
    static class Scanner
    {
        BufferedReader br;
        StringTokenizer tk=new StringTokenizer("");
        public Scanner(InputStream is) 
        {
            br=new BufferedReader(new InputStreamReader(is));
        }
        public int nextInt() throws IOException
        {
            if(tk.hasMoreTokens())
                return Integer.parseInt(tk.nextToken());
            tk=new StringTokenizer(br.readLine());
            return nextInt();
        }
        public long nextLong() throws IOException
        {
            if(tk.hasMoreTokens())
                return Long.parseLong(tk.nextToken());
            tk=new StringTokenizer(br.readLine());
            return nextLong();
        }
        public String next() throws IOException
        {
            if(tk.hasMoreTokens())
                return (tk.nextToken());
            tk=new StringTokenizer(br.readLine());
            return next();
        }
        public String nextLine() throws IOException
        {
            tk=new StringTokenizer("");
            return br.readLine();
        }
        public double nextDouble() throws IOException
        {
            if(tk.hasMoreTokens())
                return Double.parseDouble(tk.nextToken());
            tk=new StringTokenizer(br.readLine());
            return nextDouble();
        }
        public char nextChar() throws IOException
        {
            if(tk.hasMoreTokens())
                return (tk.nextToken().charAt(0));
            tk=new StringTokenizer(br.readLine());
            return nextChar();
        }
        public int[] nextIntArray(int n) throws IOException
        {
            int a[]=new int[n];
            for(int i=0;i<n;i++)
                a[i]=nextInt();
            return a;
        }
        public long[] nextLongArray(int n) throws IOException
        {
            long a[]=new long[n];
            for(int i=0;i<n;i++)
                a[i]=nextLong();
            return a;
        }
        public int[] nextIntArrayOneBased(int n) throws IOException
        {
            int a[]=new int[n+1];
            for(int i=1;i<=n;i++)
                a[i]=nextInt();
            return a;
        }
        public long[] nextLongArrayOneBased(int n) throws IOException
        {
            long a[]=new long[n+1];
            for(int i=1;i<=n;i++)
                a[i]=nextLong();
            return a;
        }
    
    
    }
    
    public static void main(String args[]) throws IOException
    {
        Scanner in=new Scanner(System.in);
        PrintWriter out=new PrintWriter(System.out);
        int n=in.nextInt();
        int k=in.nextInt();
        if(k>10)
        {
            System.out.println("No");
            return;
        }
        long p=1;
        for(int i=1;i<=k;i++)
            p*=3;
        p++;
        if(n<p)
        {
            System.out.println("No");
            return;
        }
        ArrayList<Integer> g[]=new ArrayList[n+1];
        for(int i=1;i<=n;i++)
        {
            g[i]=new ArrayList<>();
        }
        for(int i=1;i<n;i++)
        {
            int u=in.nextInt(),v=in.nextInt();
            g[u].add(v);
            g[v].add(u);
        }
        int sz[]=new int[n+1];
        for(int i=1;i<=n;i++)
            sz[i]=g[i].size();
        Queue<Integer> q=new ArrayDeque<>();
        int c[]=new int[n+1];
        for(int i=1;i<=n;i++)
            if(g[i].size()==1)
                c[g[i].get(0)]++;
        boolean ans=true;
        for(int i=1;i<=n;i++)
            if(g[i].size()!=1)
                q.add(i);
        k--;
        while(k--!=0)
        {
            ArrayList<Integer> b=new ArrayList<>();
            int saz=q.size();
            for(int i=0;i<saz;i++)
            {
                int x=q.poll();
                if(c[x]!=0)
                {
                    if(c[x]<3)
                    {
                        ans=false;
                        break;
                    }
                    else
                        b.add(x);
                }
                else
                    q.add(x);
            }
            if(b.size()<3)
                ans=false;
            if(!ans)
                break;
            ArrayList<Integer> e=new ArrayList<>();
            for(int x:b)
            {
                int cnt=0;
                for(int d:g[x])
                {
                    if(sz[d]!=1)
                    {
                        e.add(d);
                        cnt++;
                    }
                }
                if(cnt!=1)
                {
                    ans=false;
                    break;
                }
                    
            }
            if(!ans)
                break;
            for(int x:e)
                c[x]++;
            for(int x:b)
                sz[x]=1;
        }
        if(q.size()!=1)
            ans=false;
        if(q.isEmpty()||sz[q.poll()]<3)
            ans=false;
        out.println(ans?"Yes":"No");
        out.close();
    }

}
