#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC target("avx2")
using namespace std;
using ll = int64_t;
constexpr int N = 100010;
int n, k;
vector<int> g[N];
int hedge[N];
int remains[N];
int main() {
  scanf("%d%d", &n, &k);
  for (int i = 0; i < n - 1; i++) {
    int u, v;
    scanf("%d%d", &u, &v);
    --u, --v;
    g[u].push_back(v);
    g[v].push_back(u);
  }
  memset(hedge, -1, sizeof(hedge));
  vector<int> layer;
  for (int i = 0; i < n; i++) {
    remains[i] = g[i].size();
    if (g[i].size() == 1) {
      hedge[i] = 0;
      layer.push_back(i);
    }
  }
  for (int it = 1; !layer.empty(); ++it) {
    vector<int> new_layer;
    for (int u : layer) {
      for (int v : g[u]) {
        if (hedge[v] == -1) {
          --remains[v];
          assert(remains[v] > 0);
          if (remains[v] == 1) {
            new_layer.push_back(v);
            hedge[v] = it;
          }
        }
      }
    }
    layer = std::move(new_layer);
  }
  bool fail = false;
  int maxes = 0;
  for (int u = 0; u < n; u++) {
    if (hedge[u] == -1) fail = true;
    if (hedge[u] > k) fail = true;
    if (hedge[u] == k) ++maxes;
    int smaller = 0, larger = 0;
    for (int v : g[u]) {
      if (hedge[v] == hedge[u] + 1) {
        larger++;
      } else if (hedge[v] == hedge[u] - 1) {
        smaller++;
      } else {
        fail = true;
      }
    }
    if (larger != 1 && hedge[u] < k) fail = true;
    if (hedge[u] == 0) {
      if (smaller != 0 || larger != 1) fail = true;
    }
    if (hedge[u] > 0 && smaller < 3) fail = true;
  }
  if (maxes != 1) fail = true;
  if (fail)
    printf("No\n");
  else
    printf("Yes\n");
  return 0;
}
