#include <bits/stdc++.h>
using namespace std;
vector<int> E[100005];
int d[100005];
int n, k, tar;
int bfs(int s) {
  for (int i = 1; i <= n; i++) d[i] = -1;
  d[s] = 0;
  queue<int> q;
  q.push(s);
  while (q.size()) {
    int u = q.front();
    q.pop();
    for (int i = 0; i < E[u].size(); i++) {
      if (d[E[u][i]] == -1) {
        d[E[u][i]] = d[u] + 1;
        q.push(E[u][i]);
      }
    }
  }
  int mx = 1;
  for (int i = 2; i <= n; i++) {
    if (d[i] > d[mx]) mx = i;
  }
  return mx;
}
vector<int> pth;
bool dfs(int fa, int u) {
  for (int i = 0; i < E[u].size(); i++) {
    if (E[u][i] == tar) {
      pth.push_back(E[u][i]);
      pth.push_back(u);
      return 1;
    } else if (E[u][i] != fa) {
      bool q = dfs(u, E[u][i]);
      if (q) {
        pth.push_back(u);
        return 1;
      }
    }
  }
  return 0;
}
void ddfs(int fa, int u, int d) {
  if (E[u].size() > 1 && E[u].size() < 4 && fa) {
    puts("No");
    exit(0);
  } else if (fa == 0 && E[u].size() < 3) {
    puts("No");
    exit(0);
  } else if (E[u].size() == 1 && d != k) {
    puts("No");
    exit(0);
  }
  for (int i = 0; i < E[u].size(); i++) {
    if (E[u][i] != fa) ddfs(u, E[u][i], d + 1);
  }
  return;
}
int main() {
  scanf("%d%d", &n, &k);
  for (int i = 2; i <= n; i++) {
    int u, v;
    scanf("%d%d", &u, &v);
    E[u].push_back(v);
    E[v].push_back(u);
  }
  int s = bfs(1);
  int t = bfs(s);
  tar = t;
  if (k * 2 != d[t]) {
    puts("No");
    return 0;
  }
  dfs(0, s);
  ddfs(0, pth[k], 0);
  puts("Yes");
  return 0;
}
