#include <bits/stdc++.h>
using namespace std;
vector<int> adj[100005];
int depth[100005];
int mx_depth[100005];
int lev[100005];
int node;
int k;
void dfs(int u, int par) {
  for (auto v : adj[u]) {
    if (v == par) continue;
    depth[v] = depth[u] + 1;
    dfs(v, u);
    mx_depth[u] = max(mx_depth[u], mx_depth[v]);
  }
  mx_depth[u] = max(mx_depth[u], depth[u]);
}
void dfs2(int u, int par) {
  if (node != -1) return;
  if (mx_depth[u] - depth[u] == k) node = u;
  for (auto v : adj[u]) {
    if (v == par) continue;
    dfs2(v, u);
  }
}
void dfsgg(int u, int par) {
  for (auto v : adj[u]) {
    if (v == par) continue;
    lev[v] = lev[u] + 1;
    dfsgg(v, u);
  }
}
int main() {
  int n;
  scanf("%d %d", &n, &k);
  for (int i = 0; i < n - 1; i++) {
    int a, b;
    scanf("%d %d", &a, &b);
    adj[a].push_back(b);
    adj[b].push_back(a);
  }
  depth[1] = 1;
  dfs(1, 0);
  node = -1;
  dfs2(1, 0);
  if (node == -1) {
    puts("No");
    return 0;
  }
  lev[node] = 1;
  dfsgg(node, 0);
  for (int i = 1; i <= n; i++) {
    if (lev[i] == k + 1) continue;
    if (lev[i] == 1) {
      if (adj[i].size() < 3) {
        puts("No");
        return 0;
      }
    } else {
      if (adj[i].size() < 4) {
        puts("No");
        return 0;
      }
    }
  }
  puts("Yes");
  return 0;
}
