#include <bits/stdc++.h>
using namespace std;
const int N = 100000;
int eo[N], *ej[N], qu[N];
int d_, i_, cnt;
void append(int i, int j) {
  int o = eo[i]++;
  if (o >= 2 && (o & o - 1) == 0)
    ej[i] = (int *)realloc(ej[i], (o << 1) * sizeof *ej[i]);
  ej[i][o] = j;
}
void dfs1(int p, int i, int d) {
  if (d_ < d) d_ = d, i_ = i;
  for (int o = eo[i]; o--;) {
    int j = ej[i][o];
    if (j != p) dfs1(i, j, d + 1);
  }
}
bool dfs2(int p, int i, int x) {
  qu[cnt++] = i;
  if (i == x) return true;
  for (int o = eo[i]; o--;) {
    int j = ej[i][o];
    if (j != p && dfs2(i, j, x)) return true;
  }
  cnt--;
  return false;
}
bool dfs3(int p, int i, int d, int k) {
  if (p != -1 && (eo[i] == 1 && d != k || eo[i] > 1 && eo[i] < 4) ||
      p == -1 && eo[i] < 3)
    return false;
  for (int o = eo[i]; o--;) {
    int j = ej[i][o];
    if (j != p && !dfs3(i, j, d + 1, k)) return false;
  }
  return true;
}
int main() {
  int n, k;
  cin >> n >> k;
  for (int i = 0; i < n; i++) ej[i] = (int *)malloc(2 * sizeof *ej[i]);
  for (int h = 0; h < n - 1; h++) {
    int i, j;
    cin >> i >> j, i--, j--;
    append(i, j), append(j, i);
  }
  dfs1(-1, 0, 0);
  int i0 = i_;
  d_ = 0;
  dfs1(-1, i_, 0);
  int i1 = i_;
  if (d_ % 2) {
    cout << "No\n";
    return 0;
  }
  dfs2(-1, i0, i1);
  cout << (dfs3(-1, qu[(cnt - 1) / 2], 0, k) ? "Yes" : "No") << '\n';
  return 0;
}
