#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e5 + 5;
int N, K, D, X, Y;
int A[MAXN];
int B[MAXN];
vector<int> V[MAXN];
void dfs(int par, int now) {
  A[now] = A[par] + 1;
  for (int next : V[now]) {
    if (next == par) {
      continue;
    }
    dfs(now, next);
  }
  return;
}
void cek(int par, int now, int dep) {
  if (dep == 0) {
    if (V[now].size() != 1) {
      cout << "No\n";
      exit(0);
    }
    return;
  }
  if (V[now].size() < 4) {
    cout << "No\n";
    exit(0);
  }
  for (int next : V[now]) {
    if (next == par) {
      continue;
    }
    cek(now, next, dep - 1);
  }
  return;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> N >> K;
  A[0] = -1;
  for (int i = 1; i < N; i++) {
    cin >> X >> Y;
    V[X].push_back(Y);
    V[Y].push_back(X);
  }
  dfs(0, 1);
  for (int i = 1; i <= N; i++) {
    B[i] = A[i];
    if (A[i] > A[X]) {
      X = i;
    }
  }
  dfs(0, X);
  for (int i = 1; i <= N; i++) {
    if (A[i] > A[Y]) {
      Y = i;
    }
  }
  D = A[Y];
  if (D & 1) {
    cout << "No\n";
    return 0;
  }
  D >>= 1;
  for (int i = 1; i <= N; i++) {
    if (A[i] == K && B[X] - B[i] == K) {
      Y = i;
      V[Y].push_back(0);
    }
  }
  cek(0, Y, D);
  if (D != K) {
    cout << "No\n";
    return 0;
  }
  cout << "Yes\n";
  return 0;
}
