#include <bits/stdc++.h>
using namespace std;
int n, k;
vector<int> g[100010];
const int inf = 1e9;
int d[100010], p[100010];
queue<int> Q;
void bfs(int x) {
  for (int i = 1; i <= n; i++) d[i] = inf;
  d[x] = 0;
  while (!Q.empty()) Q.pop();
  Q.push(x);
  while (!Q.empty()) {
    int y = Q.front();
    Q.pop();
    for (int z : g[y]) {
      if (d[z] < inf) continue;
      d[z] = d[y] + 1;
      p[z] = y;
      Q.push(z);
    }
  }
}
bool dfs(int x, int pa, int c) {
  int d = g[x].size();
  if (pa) d--;
  if (c) {
    if (d < 3) return 0;
  } else {
    if (d) return 0;
  }
  for (int y : g[x]) {
    if (y == pa) continue;
    if (!dfs(y, x, c - 1)) return 0;
  }
  return 1;
}
int main() {
  cin >> n >> k;
  for (int i = 1, x, y; i < n; i++) {
    scanf("%d%d", &x, &y);
    g[x].push_back(y);
    g[y].push_back(x);
  }
  bfs(1);
  int x = max_element(d + 1, d + n + 1) - d;
  bfs(x);
  int y = max_element(d + 1, d + n + 1) - d;
  int l = d[y];
  while (2 * d[y] > l) y = p[y];
  puts(dfs(y, 0, k) ? "Yes" : "No");
}
