#include <bits/stdc++.h>
using namespace std;
int n, k, root;
bool visited[1000003];
vector<int> vec[100003];
queue<int> q;
void dfs(int u, int jar) {
  visited[u] = 0;
  int cnt = 0;
  for (int v : vec[u])
    if (visited[v]) dfs(v, jar + 1), ++cnt;
  if (jar == k) {
    if (cnt) {
      printf("No\n");
      exit(0);
    }
  } else {
    if (cnt < 3) {
      printf("No\n");
      exit(0);
    }
  }
}
int main() {
  scanf("%d %d", &n, &k);
  for (int i = 1; i < n; i++) {
    int u, v;
    scanf("%d %d", &u, &v);
    vec[u].push_back(v);
    vec[v].push_back(u);
  }
  for (int i = 1; i <= n; i++) {
    if (vec[i].size() == 1) {
      visited[i] = 1;
      q.push(i);
    }
  }
  while (q.size()) {
    int u = q.front();
    q.pop();
    root = u;
    for (int v : vec[u]) {
      if (!visited[v]) {
        visited[v] = 1;
        q.push(v);
      }
    }
  }
  dfs(root, 0);
  printf("Yes\n");
  return 0;
}
