#include <bits/stdc++.h>
using namespace std;
int main() {
  int i, j;
  int n, k;
  cin >> n >> k;
  set<int> s[n + 1];
  set<int> ss;
  for (i = 1; i < n; i++) {
    int x, y;
    cin >> x >> y;
    s[x].insert(y);
    s[y].insert(x);
  }
  for (i = 1; i <= n; i++) {
    ss.insert(i);
  }
  int loop = 0;
  while (ss.size() >= 2) {
    loop++;
    bool update = 0;
    map<int, int> m;
    vector<int> see;
    vector<int> va;
    for (auto it = ss.begin(); it != ss.end(); ++it) {
      j = *it;
      if (s[j].size() == 1) {
        va.push_back(j);
      }
    }
    for (int r = 0; r < va.size(); r++) {
      j = va[r];
      if (!s[j].size()) {
        cout << "No" << endl;
        return 0;
      }
      auto ite = s[j].begin();
      s[*ite].erase(j);
      m[*ite]++;
      see.push_back(j);
      update = 1;
    }
    for (auto mi = m.begin(); mi != m.end(); ++mi) {
      if (mi->second <= 2) {
        cout << "No" << endl;
        return 0;
      }
    }
    for (int w = 0; w < see.size(); w++) {
      ss.erase(see[w]);
    }
    if (update == 0) {
      cout << "No" << endl;
      return 0;
    }
  }
  if (k == loop)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  return 0;
}
