#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
int n, k, x, y, deg[N], root, u[N];
vector<vector<int> > g;
void dfs(int v, int dist, int p = 0) {
  if (dist == 0) {
    u[v] = 1;
    return;
  }
  for (auto to : g[v]) {
    if (to == p) continue;
    dfs(to, dist - 1, v);
    u[v] |= u[to];
  }
  if (u[v] && dist == k) root = v;
}
void Dfs(int v, int p = 0, int h = 0) {
  if (h > k || (deg[v] == 1 && h != k)) {
    puts("No");
    exit(0);
  }
  for (auto to : g[v]) {
    if (to == p) continue;
    Dfs(to, v, h + 1);
  }
}
int main() {
  cin >> n >> k;
  if (k > 10) {
    puts("No");
    return 0;
  }
  g.resize(n + 1);
  for (int i = 1; i < n; i++) {
    scanf("%d%d", &x, &y);
    deg[x]++;
    deg[y]++;
    g[x].push_back(y);
    g[y].push_back(x);
  }
  for (int i = 1; i <= n; i++) {
    if (deg[i] == 1) {
      dfs(i, 2 * k);
      if (deg[root] < 3 || root == 0) {
        puts("No");
        return 0;
      }
      break;
    }
  }
  for (int i = 1; i <= n; i++) {
    if (i != root && deg[i] != 1 && deg[i] < 4) {
      puts("No");
      return 0;
    }
  }
  Dfs(root);
  puts("Yes");
}
