#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, k;
  cin >> n >> k;
  vector<vector<int>> g(n);
  vector<int> cur;
  for (int i = 0; i + 1 < n; i++) {
    int u, v;
    cin >> u >> v;
    u--;
    v--;
    g[u].push_back(v);
    g[v].push_back(u);
  }
  for (int i = 0; i < n; i++) {
    if ((int)g[i].size() == 1) cur.push_back(i);
  }
  vector<int> vis(n);
  int depth = 1;
  while (cur.size()) {
    vector<int> nxt;
    for (int var : cur) {
      vis[var] = depth;
      for (int nbr : g[var]) {
        if (!vis[nbr]) {
          nxt.push_back(nbr);
        } else {
          if (vis[nbr] != depth - 1) {
            cout << "No" << endl;
            return 0;
          }
        }
      }
    }
    sort(nxt.begin(), nxt.end());
    nxt.erase(unique(nxt.begin(), nxt.end()), nxt.end());
    for (int var : nxt) {
      int cnt = 0;
      for (int nbr : g[var]) {
        if (vis[nbr]) cnt++;
      }
      if (cnt < 3) {
        cout << "No" << endl;
        return 0;
      }
    }
    if ((int)nxt.size() == 1) {
      cout << (depth == k ? "Yes" : "No") << endl;
      return 0;
    }
    depth++;
    swap(cur, nxt);
  }
  cout << "No" << endl;
  return 0;
}
