#include <bits/stdc++.h>
using namespace std;
int n, k, br[100005];
set<int> ms[100005], s[2];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> k;
  for (int i = 0; i < n - 1; ++i) {
    int u, v;
    cin >> u >> v;
    ms[u].insert(v);
    ms[v].insert(u);
  }
  for (int i = 1; i <= n; ++i) {
    if ((int)ms[i].size() == 1) {
      s[0].insert(i);
    }
  }
  bool sad = 0;
  while (n > 1) {
    for (set<int>::iterator i = s[sad].begin(); i != s[sad].end(); ++i) {
      int o = *i;
      int u = *(ms[o].begin());
      ms[u].erase(o);
      s[sad ^ 1].insert(u);
      br[u]++;
      n--;
    }
    for (set<int>::iterator i = s[sad ^ 1].begin(); i != s[sad ^ 1].end();
         ++i) {
      int o = *i;
      if (br[o] < 3) {
        cout << "No" << endl;
        return 0;
      }
      br[o] = 0;
    }
    s[sad].clear();
    sad ^= 1;
    k--;
  }
  cout << (!k ? "Yes" : "No") << endl;
  return 0;
}
