#include <bits/stdc++.h>
const int N = 1e5 + 1;
std::set<int> adj[N];
int main() {
  int n, k;
  scanf("%d%d", &n, &k);
  for (int i = 1; i < n; ++i) {
    int u, v;
    scanf("%d%d", &u, &v);
    adj[u].insert(v);
    adj[v].insert(u);
  }
  bool found_center = false;
  int center = 0;
  std::set<int> leaf;
  for (int i = 1; i <= n; ++i)
    if (adj[i].size() == 2) {
      printf("No");
      return 0;
    } else if (adj[i].size() == 3)
      if (!found_center) {
        found_center = true;
        center = i;
      } else {
        printf("No");
        return 0;
      }
    else if (adj[i].size() == 1)
      leaf.insert(i);
  for (int i = 1; i <= k; ++i) {
    std::set<int> parent;
    for (int u : leaf)
      if (adj[u].size() != 1) {
        printf("No");
        return 0;
      }
    for (int u : leaf) {
      int v = *adj[u].begin();
      adj[v].erase(u);
      parent.insert(v);
    }
    std::swap(leaf, parent);
  }
  if (leaf.size() != 1) {
    printf("No");
    return 0;
  }
  int last = *leaf.begin();
  if (!found_center || last == center)
    printf("Yes");
  else
    printf("No");
  return 0;
}
