#include <bits/stdc++.h>
using namespace std;
set<int> second[100005];
bool used[100005];
int c[100005];
vector<int> v;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n, k;
  cin >> n >> k;
  for (int i = 1; i < n; i++) {
    int x, y;
    cin >> x >> y;
    second[x].insert(y);
    second[y].insert(x);
  }
  for (int i = 1; i <= n; i++) {
    if (second[i].size() == 1) {
      v.push_back(i);
      used[i] = true;
    }
  }
  while (k >= 1) {
    if (v.empty()) {
      cout << "No" << endl;
      return 0;
    }
    vector<int> nv;
    for (int x : v) {
      int y = *second[x].begin();
      c[y]++;
      second[x].erase(y);
      second[y].erase(x);
      if (used[y] == false) {
        used[y] = true;
        nv.push_back(y);
      }
    }
    for (int x : nv) {
      if (c[x] < 3 || second[x].size() != min(1, k - 1)) {
        cout << "No" << endl;
        return 0;
      }
    }
    v = nv;
    k--;
  }
  cout << "Yes" << endl;
  return 0;
}
