#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
int power(int a, int b, int mod) {
  int res = 1;
  while (b) {
    if (b & 1) {
      res = 1LL * res * a % mod;
    }
    a = 1LL * a * a % mod;
    b >>= 1;
  }
  return res;
}
int n, k, root = -1, fail = 0;
vector<int> adj[N];
int dfs(int node = 1, int par = 0) {
  int max_len = 0;
  for (int child : adj[node]) {
    if (child == par) continue;
    max_len = max(max_len, dfs(child, node));
  }
  if (max_len == k) {
    root = node;
  }
  return max_len + 1;
}
int dfs1(int node, int par, int h) {
  int val = (node == root ? 3 : 4);
  if (h < 0 || (h > 0 && adj[node].size() < val)) fail = 1;
  for (int child : adj[node]) {
    if (child == par) continue;
    fail |= dfs1(child, node, h - 1);
  }
  return fail;
}
int main() {
  int u, v;
  scanf("%d %d", &n, &k);
  for (int i = 1; i < n; i++) {
    scanf("%d %d", &u, &v);
    adj[u].push_back(v);
    adj[v].push_back(u);
  }
  dfs();
  if (root == -1) {
    printf("No\n");
    return 0;
  }
  fail |= dfs1(root, 0, k);
  if (fail)
    printf("No\n");
  else {
    printf("Yes\n");
  }
  return 0;
}
