#include <bits/stdc++.h>
using namespace std;
template <class T>
using min_heap = priority_queue<T, std::vector<T>, std::greater<T> >;
const int lim = 1e5 + 5;
long long n, k, u, v, cn;
map<long long, long long> deg;
set<long long> adj[lim];
int main() {
  cin >> n >> k;
  for (int i = 1; i <= n - 1; i++) {
    cin >> u >> v;
    adj[u].insert(v);
    adj[v].insert(u);
    deg[u]++;
    deg[v]++;
  }
  for (int i = 1; i <= k; i++) {
    if (int(deg.size()) == 1) {
      cout << "No" << endl;
      return 0;
    }
    vector<long long> ss;
    for (auto u : deg) {
      if (u.second == 1) ss.push_back(u.first);
    }
    map<long long, long long> ch;
    for (long long u : ss) {
      long long pp = *(adj[u].begin());
      ch[pp]++;
      deg.erase(u);
      adj[u].erase(pp);
      adj[pp].erase(u);
    }
    for (auto u : ch) {
      if (u.second < 3) {
        cout << "No" << endl;
        return 0;
      }
      deg[u.first] -= ch[u.first];
    }
  }
  if (int(deg.size()) == 1 && deg.begin()->second == 0) {
    cout << "Yes" << endl;
  } else
    cout << "No" << endl;
}
