#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
int n, K;
struct edge {
  int to, next;
} e[N << 1];
int head[N], cnt, num;
int vis[N];
int in[N];
inline void add(int x, int y) {
  e[++cnt].to = y;
  e[cnt].next = head[x];
  head[x] = cnt;
}
inline void solve() {
  queue<int> q[2];
  for (int i = 1; i <= n; i++)
    if (in[i] == 1) q[0].push(i), vis[i] = 0;
  for (int t = 0;; t ^= 1) {
    while (!q[t].empty()) {
      int x = q[t].front();
      q[t].pop();
      if (in[x] == 0) continue;
      int u;
      for (int i = head[x]; i; i = e[i].next) {
        if (in[e[i].to] == 0) continue;
        u = e[i].to;
        break;
      }
      if (in[u] < 3) {
        printf("No\n");
        exit(0);
      }
      int tot = 0;
      for (int i = head[u]; i; i = e[i].next) {
        int v = e[i].to;
        if (in[v] == 1 && vis[v] == t) in[v]--, in[u]--, tot++;
      }
      if (tot < 3) {
        printf("No\n");
        exit(0);
      }
      q[t ^ 1].push(u);
      vis[u] = t ^ 1;
    }
    if (q[t ^ 1].empty()) break;
    num++;
  }
}
int main() {
  scanf("%d%d", &n, &K);
  memset(vis, -1, sizeof(vis));
  for (int i = 1, x, y; i < n; i++) {
    scanf("%d%d", &x, &y);
    add(x, y);
    add(y, x);
    in[x]++;
    in[y]++;
  }
  if (K >= n) {
    printf("No\n");
    return 0;
  }
  solve();
  if (num == K)
    printf("Yes\n");
  else
    printf("No\n");
  return 0;
}
