#include <bits/stdc++.h>
using namespace std;
long long n, k;
vector<long long> dsk[100005];
long long H[100005], passed[100005], Child_cnt[100005];
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> k;
  long long u, v;
  for (long long i = 1; i <= n; i++) {
    if (i < n) {
      cin >> u >> v;
      dsk[u].push_back(v);
      dsk[v].push_back(u);
    }
    H[i] = -1;
    passed[i] = Child_cnt[i] = 0;
  }
  queue<long long> Q;
  for (long long i = 1; i <= n; i++)
    if (dsk[i].size() == 1) {
      H[i] = 0;
      Q.push(i);
    }
  while (!Q.empty()) {
    long long t = Q.front();
    Q.pop();
    if (passed[t] == 1) continue;
    passed[t] = 1;
    if (H[t] > 0 && Child_cnt[t] < 3) {
      cerr << "NO-CHILD ERROR!";
      cout << "No\n";
      return 0;
    }
    for (long long i : dsk[t])
      if (passed[i] == 0) {
        if (H[i] == -1) {
          H[i] = H[t] + 1;
          Q.push(i);
        } else if (H[i] != H[t] + 1) {
          cerr << "UNBALANCED!";
          cout << "No\n";
          return 0;
        }
        Child_cnt[i]++;
      }
  }
  long long kcnt = 0;
  for (long long i = 1; i <= n; i++) kcnt += (H[i] == k);
  if (kcnt == 1)
    cout << "Yes\n";
  else {
    cerr << "MORE THAN K HED";
    cout << "No\n";
  }
}
