#include <bits/stdc++.h>
using namespace std;
bool vis[100007];
int cnt;
vector<int> v[100007];
unordered_set<int> s[12];
int main() {
  int n, k, x, y, sz = 0;
  bool fl = 1;
  scanf("%d", &n);
  ;
  scanf("%d", &k);
  ;
  for (int i = 0; i < n - 1; ++i) {
    scanf("%d", &x);
    ;
    scanf("%d", &y);
    ;
    v[x].push_back(y);
    v[y].push_back(x);
  }
  if (n == 1) {
    cout << "No";
    return 0;
  }
  for (int i = 1; i <= n; ++i) {
    if (v[i].size() == 1) {
      vis[i] = 1;
      s[1].insert(v[i][0]);
      ++cnt;
    }
  }
  sz = 1;
  while (cnt < n && fl) {
    if (sz == k && s[sz].size() > 1) {
      fl = 0;
      break;
    }
    for (auto it : s[sz]) {
      vis[it] = 1;
      ++cnt;
      if (sz == k && v[it].size() < 3) {
        fl = 0;
        break;
      } else if (sz < k && v[it].size() < 4) {
        fl = 0;
        break;
      }
      for (int j = 0; j < v[it].size(); ++j)
        if (!vis[v[it][j]]) s[sz + 1].insert(v[it][j]);
    }
    ++sz;
  }
  if (fl && sz == k + 1)
    printf("Yes\n");
  else
    printf("NO\n");
  return 0;
}
