#include <bits/stdc++.h>
using namespace std;
vector<vector<int>> adj;
vector<int> vis, p, d;
bool ok;
int k, c;
void dfs(int u) {
  for (int v : adj[u]) {
    if (vis[v] == 0) {
      vis[v] = 1;
      p[v] = u;
      d[v] = d[u] + 1;
      dfs(v);
    }
  }
}
void dfs1(int u, int d) {
  if (((d < k) && adj[u].size() < 4 - (u == c)) ||
      (d == k) && adj[u].size() != 1)
    ok = 0;
  for (int v : adj[u]) {
    if (vis[v] == 0) {
      vis[v] = 1;
      dfs1(v, d + 1);
    }
  }
}
int main() {
  int n;
  cin >> n >> k;
  adj.resize(n + 1);
  for (int i = 1; i < n; i++) {
    int u, v;
    cin >> u >> v;
    adj[u].push_back(v);
    adj[v].push_back(u);
  }
  vis.resize(n + 1);
  p.resize(n + 1);
  d.resize(n + 1);
  for (int i = 1; i <= n; i++) {
    if (adj[i].size() == 1) {
      vis[i] = 1, dfs(i);
      break;
    }
  }
  int e = distance(d.begin(), max_element(d.begin(), d.end()));
  int dia = d[e];
  if (dia / 2 != k) {
    cout << "No\n";
    return 0;
  }
  while (d[e] != dia / 2) e = p[e];
  vis.assign(n + 1, 0);
  ok = 1;
  c = e;
  vis[c] = 1;
  dfs1(c, 0);
  cout << (ok ? "Yes" : "No") << '\n';
}
