#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios_base::sync_with_stdio(false);
  long long n, k, u, v;
  cin >> n >> k;
  vector<set<long long>> graph(n);
  for (long long i = 1; i < n; ++i) {
    cin >> u >> v;
    --u;
    --v;
    graph[u].insert(v);
    graph[v].insert(u);
  }
  set<long long> yet_existing;
  long long uc;
  for (long long i = 0; i < n; ++i) yet_existing.insert(i);
  vector<long long> counter(n, 0);
  vector<long long> process_visyach;
  while (k > 0) {
    for (auto i : yet_existing) {
      if (graph[i].size() == 0) {
        cout << "No" << '\n';
        return 0;
      }
      if (graph[i].size() == 1) {
        process_visyach.push_back(i);
      }
    }
    for (auto i : process_visyach) {
      uc = *(graph[i].begin());
      graph[uc].erase(i);
      yet_existing.erase(i);
      ++counter[uc];
    }
    if (yet_existing.size() == 0) {
      cout << "No" << '\n';
      return 0;
    }
    for (auto i : yet_existing) {
      if (counter[i] != 0 && counter[i] < 3) {
        cout << "No" << '\n';
        return 0;
      }
    }
    for (auto& e : counter) e = 0;
    --k;
  }
  if (yet_existing.size() > 1) {
    cout << "No" << '\n';
    return 0;
  }
  cout << "Yes" << '\n';
}
