#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 22;
int n, k;
int zz[N], zz2[N];
bool vis[N];
set<pair<int, int> > q;
vector<int> G[N];
int main() {
  ios::sync_with_stdio(false), cin.tie(0);
  int x, y;
  cin >> n >> k;
  for (int i = 0; i < (n - 1); i++) {
    cin >> x >> y;
    x--, y--;
    G[x].push_back(y);
    G[y].push_back(x);
    zz[x]++;
    zz2[x]++;
    zz[y]++;
    zz2[y]++;
  }
  for (int i = 0; i < (n); i++) {
    q.insert({int((G[i]).size()), i});
  }
  while (k) {
    vector<int> vec;
    while (!q.empty()) {
      auto it = q.begin();
      if (it->first != 1) break;
      int sw = -1;
      for (auto &u : (G[it->second])) {
        if (!vis[u]) vec.push_back(u), sw = 1, zz2[u]--;
      }
      vis[it->second] = 1;
      q.erase(it);
      if (sw == -1) return cout << "No", 0;
    }
    (sort(vec.begin(), vec.end()),
     vec.resize(distance(vec.begin(), unique(vec.begin(), vec.end()))));
    if (vec.empty()) return cout << "No", 0;
    for (auto &u : (vec)) {
      if (zz2[u] != 1 && k != 1) return cout << "No", 0;
      if (zz[u] < 4 && k != 1) return cout << "No", 0;
      q.erase({zz[u], u});
      q.insert({1, u});
    }
    k--;
  }
  if (q.size() == 1 && zz[q.begin()->second] >= 3)
    cout << "Yes";
  else
    cout << "No";
  return 0;
}
