#include <bits/stdc++.h>
using namespace std;
vector<int> g[100001];
int s[100001], n, num, kk;
int en[100001];
void gs(int x, int p) {
  if (s[x] > s[num]) num = x;
  for (int y : g[x]) {
    if (y == p) continue;
    s[y] = s[x] + 1;
    gs(y, x);
  }
}
void gc(int x, int p) {
  if (s[x] == 2 * kk) en[x] = 1;
  for (int y : g[x]) {
    if (y == p) continue;
    s[y] = s[x] + 1;
    gc(y, x);
    en[x] |= en[y];
  }
  if (en[x] && s[x] == kk) num = x;
}
bool sol(int x, int k, int p) {
  if (k == 0) return g[x].size() == 1;
  int cnt = 0;
  for (int y : g[x]) {
    if (y == p) continue;
    if (!sol(y, k - 1, x)) return 0;
    cnt++;
  }
  if (cnt < 3) return 0;
  return 1;
}
int main() {
  int k, i, a, b;
  scanf("%d%d", &n, &k);
  kk = k;
  for (i = 0; i < n - 1; i++) {
    scanf("%d%d", &a, &b);
    g[a].push_back(b);
    g[b].push_back(a);
  }
  gs(1, 0);
  s[num] = 0;
  gc(num, 0);
  if (sol(num, k, 0))
    printf("Yes");
  else
    printf("No");
  getchar();
  getchar();
}
