#include <bits/stdc++.h>
using namespace std;
vector<vector<int> > G, G_or;
vector<int> d;
vector<char> used;
void dfs1(int v) {
  used[v] = 1;
  for (auto to : G[v]) {
    if (used[to]) continue;
    G_or[v].push_back(to);
    d[to] = d[v] + 1;
    dfs1(to);
  }
}
int main() {
  int n, k;
  cin >> n >> k;
  used.assign(n, 0);
  d.assign(n, 0);
  G.assign(n, vector<int>(0));
  G_or.assign(n, vector<int>(0));
  queue<int> bfs;
  for (int i = 0, a, b; i < n - 1; i++) {
    cin >> a >> b;
    --a;
    --b;
    G[a].push_back(b);
    G[b].push_back(a);
  }
  for (int v = 0; v < n; v++) {
    if (G[v].size() == 1) {
      used[v] = 1;
      bfs.push(v);
    }
  }
  while (bfs.size()) {
    int v = bfs.front();
    bfs.pop();
    for (auto to : G[v]) {
      if (!used[to]) {
        bfs.push(to);
        used[to] = 1;
        d[to] = d[v] + 1;
      }
    }
  }
  int root = 0;
  for (int v = 0; v < n; v++) {
    if (d[v] > d[root]) root = v;
  }
  used.assign(n, 0);
  d.assign(n, 0);
  dfs1(root);
  for (int v = 0; v < n; v++) {
    if (d[v] == k) {
      if (G_or[v].size() != 0) return cout << "No", 0;
    } else if (G_or[v].size() < 3)
      return cout << "No", 0;
  }
  cout << "Yes";
  return 0;
}
