#include <bits/stdc++.h>
using namespace std;
vector<set<int> > g;
vector<int> g1[500001];
vector<int> par;
vector<int> dist;
vector<int> deg;
vector<int> deg3;
void bfs(int sr) {
  queue<int> q;
  q.push(sr);
  while (!q.empty()) {
    int u = q.front();
    q.pop();
    bool fg = 0;
    for (int v : g1[u]) {
      if (v == par[u]) continue;
      dist[v] = dist[u] + 1;
      fg = 1;
      q.push(v);
    }
    deg[par[u]] -= fg;
  }
}
int main() {
  int n, k;
  cin >> n >> k;
  g.resize(n + 1);
  par.resize(n + 1);
  deg.resize(n + 1);
  dist.resize(n + 1);
  for (int i = 0; i < n - 1; i++) {
    int u, v;
    cin >> u >> v;
    g[u].insert(v);
    g[v].insert(u);
    g1[u].push_back(v);
    g1[v].push_back(u);
    deg[u] += 1;
    deg[v] += 1;
  }
  deg3 = deg;
  bool fg = 1;
  vector<int> deg2 = deg;
  while (fg) {
    fg = 0;
    for (int u = 1; u <= n; u++) {
      if (deg2[u] == 1) {
        fg = 1;
        int v = *g[u].begin();
        par[u] = v;
        g[u].erase(v);
        g[v].erase(u);
      }
    }
    for (int u = 1; u <= n; u++) {
      if (deg2[u] != g[u].size() && g[u].size() > 0 &&
          deg2[u] - g[u].size() < 3) {
        cout << "No" << '\n';
        return 0;
      }
      deg2[u] = g[u].size();
    }
  }
  int root;
  for (int i = 1; i <= n; i++) {
    if (par[i] == 0) {
      root = i;
      break;
    }
  }
  bfs(root);
  int t = max_element(dist.begin(), dist.end()) - dist.begin();
  t = dist[t];
  if (t != k) {
    cout << "No" << '\n';
    return 0;
  }
  if (g1[root].size() < 3) {
    cout << "No" << '\n';
    return 0;
  }
  for (int i = 1; i <= n; i++) {
    if (i == root) {
      if (deg[i] != 0 && deg[i] != deg3[i]) {
        cout << "No" << '\n';
        return 0;
      }
    } else if (deg[i] != 1 && deg[i] != deg3[i]) {
      cout << "No" << '\n';
      return 0;
    }
  }
  cout << "Yes" << '\n';
}
