#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  int n, k;
  cin >> n >> k;
  if (n < 4) {
    cout << "No" << endl;
    return 0;
  }
  vector<vector<int> > g(n);
  for (int i = (0); i < (int)(n - 1); ++i) {
    int a, b;
    cin >> a >> b;
    --a, --b;
    g[a].emplace_back(b);
    g[b].emplace_back(a);
  }
  vector<int> dist(n, -1);
  queue<int> bfs;
  for (int i = (0); i < (int)(n); ++i)
    if (g[i].size() == 1) {
      bfs.push(i);
      dist[i] = 0;
    }
  while (!bfs.empty()) {
    int a = bfs.front();
    bfs.pop();
    for (int b : g[a]) {
      if (dist[b] == -1) {
        dist[b] = dist[a] + 1;
        bfs.push(b);
      }
    }
  }
  int mx = 0;
  for (int i = (0); i < (int)(n); ++i) mx = max(dist[i], mx);
  int root = -1;
  for (int i = (0); i < (int)(n); ++i)
    if (dist[i] == mx) {
      if (root != -1) {
        cout << "No" << endl;
        return 0;
      }
      root = i;
    }
  function<bool(int, int, int)> dfs = [&](int x, int p, int k) {
    if (k && g[x].size() < 4) return false;
    if (!k && g[x].size() > 1) return false;
    for (int y : g[x])
      if (y != p)
        if (dfs(y, x, k - 1) == false) return false;
    return true;
  };
  g[root].emplace_back(-1);
  if (dfs(root, -1, k))
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  return 0;
}
