#include <bits/stdc++.h>
using namespace std;
vector<long long> adj[100005];
long long dg[100005], sk[100005], n, k;
bool vis[100005];
int32_t main() {
  scanf("%lld%lld", &n, &k);
  for (long long i = 1; i < n; i++) {
    long long x, y;
    cin >> x >> y;
    dg[x]++, dg[y]++;
    adj[x].push_back(y);
    adj[y].push_back(x);
  }
  queue<long long> q;
  for (long long i = 1; i <= n; i++) {
    sk[i] = -1;
    if (dg[i] == 1) {
      sk[i] = 0;
      q.push(i);
    }
  }
  bool can = true;
  while (!q.empty()) {
    long long u = q.front();
    q.pop();
    vis[u] = true;
    for (auto p : adj[u]) {
      if (vis[p]) continue;
      if (sk[p] != -1) {
        if (sk[p] != sk[u] + 1) can = false;
      }
      sk[p] = sk[u] + 1;
      dg[p]--;
      if (dg[p] == 1) {
        q.push(p);
      }
    }
  }
  for (long long i = 1; i <= n; i++) {
    if (vis[i] == false) can = false;
  }
  long long cnt = 0;
  for (long long i = 1; i <= n; i++) {
    if (sk[i] == k) cnt++;
  }
  if (cnt != 1) can = false;
  long long cnt3 = 0;
  for (long long i = 1; i <= n; i++) {
    if (adj[i].size() == 1) continue;
    if (sk[i] == k) {
      if (adj[i].size() < 3) can = false;
      continue;
    }
    if (adj[i].size() < 4) can = false;
  }
  if (can)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}
