#include <bits/stdc++.h>
const int maxn = 1e5 + 7;
using namespace std;
int n, k, root, ans, cnt;
int ls[maxn], son[maxn], r[maxn], dis[maxn], f[maxn];
struct edge {
  int y, next;
} g[maxn * 2];
void add(int x, int y) {
  g[++cnt] = (edge){y, ls[x]};
  ls[x] = cnt;
}
void findroot(int x, int fa) {
  f[x] = fa;
  for (int i = ls[x]; i > 0; i = g[i].next) {
    int y = g[i].y;
    if (y == fa) continue;
    dis[y] = dis[x] + 1;
    findroot(y, x);
  }
}
void dfs(int x, int fa, int dep) {
  for (int i = ls[x]; i > 0; i = g[i].next) {
    int y = g[i].y;
    if (y == fa) continue;
    son[x]++;
    dfs(y, x, dep + 1);
  }
  if (dep > k) ans = 0;
  if ((dep == k) && (son[x])) ans = 0;
  if ((dep < k) && (son[x] <= 2)) ans = 0;
}
int main() {
  scanf("%d%d", &n, &k);
  for (int i = 1; i < n; i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    add(x, y);
    add(y, x);
    r[x]++, r[y]++;
  }
  for (int i = 1; i <= n; i++) {
    if (r[i] == 1) {
      root = i;
      break;
    }
  }
  findroot(root, 0);
  for (int i = 1; i <= n; i++) {
    if (dis[i] > dis[root]) root = i;
  }
  ans = 1;
  if (dis[root] != k * 2)
    ans = 0;
  else {
    for (int i = 1; i <= k; i++) root = f[root];
    dfs(root, 0, 0);
  }
  if (ans)
    printf("Yes");
  else
    printf("No");
}
