#include <bits/stdc++.h>
using namespace std;
vector<int> E[200000];
int d[200000];
int main() {
  int n, K;
  cin >> n >> K;
  for (int i = 0; i < (n - 1); i++) {
    int a, b;
    scanf("%d%d", &a, &b);
    a--;
    b--;
    E[a].push_back(b);
    E[b].push_back(a);
  }
  queue<int> que;
  memset(d, -1, sizeof(d));
  for (int i = 0; i < (n); i++) {
    if (E[i].size() == 1) {
      d[i] = 0;
      que.push(i);
    }
  }
  while (!que.empty()) {
    int p = que.front();
    que.pop();
    for (int u : E[p]) {
      if (d[u] == -1) {
        d[u] = d[p] + 1;
        que.push(u);
      }
    }
  }
  int root = max_element(d, d + n) - d;
  memset(d, -1, sizeof(d));
  d[root] = 0;
  que.push(root);
  while (!que.empty()) {
    int p = que.front();
    que.pop();
    for (int u : E[p]) {
      if (d[u] == -1) {
        d[u] = d[p] + 1;
        que.push(u);
      }
    }
  }
  if (E[root].size() < 3) {
    puts("No");
    return 0;
  }
  for (int i = 0; i < (n); i++) {
    if (i == root) continue;
    if (E[i].size() == 1 && d[i] != K) {
      puts("No");
      return 0;
    }
    if (E[i].size() != 1 && E[i].size() <= 3) {
      puts("No");
      return 0;
    }
  }
  puts("Yes");
}
