#include <bits/stdc++.h>
using namespace std;
set<int> s[100005];
int m[100005];
set<int> t, v;
int cnt[100005];
int n, k;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ;
  cin >> n >> k;
  int x, y;
  for (int i = 1; i < n; i++) {
    cin >> x >> y;
    s[x].insert(y);
    s[y].insert(x);
    m[x]++;
    m[y]++;
  }
  for (int i = 1; i <= n; i++) {
    if (m[i] == 1) v.insert(i);
  }
  while (n > 1) {
    t.clear();
    for (auto to : v) {
      auto it = s[to].begin();
      t.insert(*it);
      cnt[*it]++;
      s[*it].erase(to);
      n--;
    }
    for (auto w : t) {
      if (cnt[w] < 3) {
        cout << "No" << endl;
        return 0;
      }
      cnt[w] = 0;
    }
    swap(t, v);
    k--;
  }
  if (k == 0)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  return 0;
}
