#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 4;
vector<int> adj[N];
int deg[N];
int lv[N];
int decr[N];
int vis[N];
int main() {
  int n, k;
  scanf("%d%d", &n, &k);
  for (int i = 0; i < n - 1; i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    adj[x].push_back(y);
    adj[y].push_back(x);
    deg[x]++;
    deg[y]++;
  }
  queue<pair<int, int>> q;
  bool yes = n > 3;
  for (int i = 1; i <= n; i++)
    if (deg[i] == 1) q.push({i, 0}), lv[i] = 1, decr[i] = 3;
  while (!q.empty()) {
    auto tmp = q.front();
    q.pop();
    int u = tmp.first;
    int p = tmp.second;
    vis[u] = 1;
    if (decr[u] < 3) yes = false;
    for (auto v : adj[u]) {
      if (vis[v]) continue;
      if (lv[v] != 0 && lv[v] != lv[u] + 1) {
        yes = false;
      }
      lv[v] = lv[u] + 1;
      deg[v]--;
      decr[v]++;
      if (lv[v] == k + 1 && deg[v] == 0)
        q.push({v, u});
      else if (deg[v] == 1)
        q.push({v, u});
    }
  }
  int mx = 0;
  for (int i = 1; i <= n; i++) mx = max(mx, lv[i]);
  yes &= (mx == k + 1);
  puts(yes ? "Yes" : "No");
}
