#include <bits/stdc++.h>
const int MAX_N = 1e5 + 7;
int n, k;
std::vector<int> gr[MAX_N];
int dist[MAX_N], pred[MAX_N];
bool good = true;
int yote(const int& cur, const int& dep = 0, const int& par = -1) {
  if (static_cast<int>(gr[cur].size()) <= 1) {
    good = good && dep == k;
    return dep;
  }
  int min = MAX_N, max = -1, vis = 0;
  for (const auto& nei : gr[cur]) {
    if (nei == par) continue;
    int ret = yote(nei, dep + 1, cur);
    min = std::min(min, ret);
    max = std::max(max, ret);
    ++vis;
  }
  good = good && min == max && vis >= 3;
  return dep;
}
int main(void) {
  std::ios::sync_with_stdio(0);
  std::cin.tie(0);
  std::cin >> n >> k;
  for (int i = 1, a, b; i < n; ++i) {
    std::cin >> a >> b;
    --a;
    --b;
    gr[a].push_back(b);
    gr[b].push_back(a);
  }
  memset(dist, 0x3f, sizeof(dist));
  std::queue<int> order;
  order.push(0);
  dist[0] = 0;
  while (order.size()) {
    int cur = order.front();
    order.pop();
    for (const auto& nei : gr[cur]) {
      if (dist[nei] > 1 + dist[cur]) {
        dist[nei] = 1 + dist[cur];
        order.push(nei);
      }
    }
  }
  int mx = std::distance(dist, std::max_element(dist, dist + n));
  memset(dist, 0x3f, sizeof(dist));
  dist[mx] = 0;
  order.push(mx);
  while (order.size()) {
    int cur = order.front();
    order.pop();
    for (const auto& nei : gr[cur]) {
      if (dist[nei] > 1 + dist[cur]) {
        dist[nei] = 1 + dist[cur];
        pred[nei] = cur;
        order.push(nei);
      }
    }
  }
  const int dia = *std::max_element(dist, dist + n);
  if (dia != 2 * k) {
    std::cout << "No\n";
    return 0;
  }
  int center = std::distance(dist, std::max_element(dist, dist + n));
  for (int i = k; i--;) {
    center = pred[center];
  }
  yote(center);
  good = good && n >= 4;
  std::cout << (good ? "Yes" : "No") << "\n";
  return 0;
}
