#include <bits/stdc++.h>
using namespace std;
long long n, k, dist[200000];
vector<long long> v[200000];
signed main() {
  cin.tie(0);
  cout.tie(0);
  ios_base::sync_with_stdio(false);
  cin >> n >> k;
  for (long long i = 1; i < n; i++) {
    long long a, b;
    cin >> a >> b;
    v[a].push_back(b);
    v[b].push_back(a);
  }
  queue<long long> q;
  for (long long i = 1; i < n + 1; i++) {
    dist[i] = 1000000000000000000;
    if (v[i].size() == 1) {
      dist[i] = 0;
      q.push(i);
    }
  }
  while (!q.empty()) {
    long long node = q.front();
    q.pop();
    for (auto x : v[node]) {
      if (dist[x] > dist[node] + 1) {
        dist[x] = dist[node] + 1;
        q.push(x);
      }
    }
  }
  long long center;
  bool found = 0;
  for (long long i = 1; i < n + 1; i++) {
    if (dist[i] == k) {
      if (found) {
        cout << "No\n";
        exit(0);
      } else {
        found = 1;
        center = i;
      }
    }
  }
  if (!found) {
    cout << "No\n";
    exit(0);
  }
  bool ok = 1;
  q.push(center);
  for (long long i = 1; i < n + 1; i++)
    ok &= ((i == center or (v[i].size() > 3 or dist[i] == 0)) and
           (i != center or v[i].size() >= 3)),
        dist[i] = 1000000000000000000;
  dist[center] = 0;
  while (!q.empty()) {
    long long node = q.front();
    q.pop();
    for (auto x : v[node]) {
      if (dist[x] > dist[node] + 1) {
        dist[x] = dist[node] + 1;
        q.push(x);
      }
    }
  }
  for (long long i = 1; i < n + 1; i++) {
    ok &= ((v[i].size() == 1 or dist[i] < k) and
           (v[i].size() > 1 or dist[i] == k));
  }
  if (ok)
    cout << "Yes\n";
  else
    cout << "No\n";
}
