#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int n, k;
vector<int> g[100100];
int deg[200200];
int dep[200200];
int par[200200];
void dfs(int node, int p, int d) {
  par[node] = p;
  dep[node] = d;
  for (auto v : g[node]) {
    if (v == p) continue;
    dfs(v, node, d + 1);
  }
}
void solve() {
  cin >> n >> k;
  for (int i = 0; i < n - 1; i++) {
    int a, b;
    cin >> a >> b;
    g[a].push_back(b);
    g[b].push_back(a);
    deg[a]++;
    deg[b]++;
  }
  dfs(1, 0, 0);
  int x = 1;
  for (int i = 2; i <= n; i++) {
    if (dep[i] > dep[x]) x = i;
  }
  dfs(x, 0, 0);
  int y = 1;
  for (int i = 2; i <= n; i++) {
    if (dep[i] > dep[y]) y = i;
  }
  int len = dep[y];
  if (len % 2) {
    cout << "No";
    return;
  }
  int temp = len / 2, c = y;
  while (temp--) {
    c = par[c];
  }
  if (deg[c] < 3) {
    cout << "No";
    return;
  }
  dfs(c, 0, 0);
  for (int i = 1; i <= n; i++) {
    if (i == c)
      continue;
    else if (deg[i] == 1) {
      if (dep[i] != k) {
        cout << "No";
        return;
      }
    } else if (deg[i] < 4) {
      cout << "No";
      return;
    }
  }
  cout << "Yes";
}
signed main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  solve();
}
