#include <bits/stdc++.h>
using namespace std;
int n, k;
struct Edge {
  int v, nxt;
} e[200010];
int tot;
int first[100010];
int d[100010];
void build(int u, int v) {
  e[++tot] = (Edge){v, first[u]};
  first[u] = tot;
  d[u]++;
  return;
}
int f[100010];
int s[100010];
queue<int> q;
bool bfs() {
  memset(s, 0x7f, sizeof(s));
  for (int i = 1; i <= n; i++)
    if (d[i] == 1) {
      q.push(i);
      s[i] = k;
    }
  bool flag = false;
  while (!q.empty()) {
    int u = q.front();
    q.pop();
    if (s[u] < 0) return false;
    if (s[u] == 0) {
      if (flag) return false;
      flag = true;
    }
    if (s[u] < k && f[u] < 3) return false;
    if (d[u] - f[u] > 1) return false;
    for (int i = first[u]; i; i = e[i].nxt) {
      f[e[i].v]++;
      if (s[e[i].v] > k) {
        s[e[i].v] = s[u] - 1;
        q.push(e[i].v);
      }
    }
  }
  return flag;
}
int main() {
  scanf("%d %d", &n, &k);
  for (int i = 1; i < n; i++) {
    int u, v;
    scanf("%d %d", &u, &v);
    build(u, v);
    build(v, u);
  }
  if (bfs())
    printf("Yes\n");
  else
    printf("No\n");
  return 0;
}
