#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 10;
int h[N], e[N], ne[N], idx, v[N], d[N], res[N];
queue<int> q;
void add(int a, int b) { e[idx] = b, ne[idx] = h[a], h[a] = idx++; }
int main() {
  memset(h, -1, sizeof h);
  int n, k;
  cin >> n >> k;
  for (int i = 1; i < n; i++) {
    int a, b;
    cin >> a >> b;
    add(a, b);
    add(b, a);
    d[a]++;
    d[b]++;
  }
  for (int i = 1; i <= n; i++)
    if (d[i] == 1) {
      v[i] = 1;
      q.push(i);
    }
  while (q.size()) {
    int t = q.front();
    q.pop();
    if (v[t] != 1 && res[t] < 3) {
      cout << "No" << endl;
      return 0;
    }
    for (int i = h[t]; ~i; i = ne[i]) {
      int j = e[i];
      if (!v[j]) {
        v[j] = v[t] + 1;
        res[j]++;
        q.push(j);
      } else {
        if (!(v[j] == v[t] + 1 || v[t] == v[j] + 1)) {
          cout << "No" << endl;
          return 0;
        }
        res[j]++;
      }
    }
  }
  int st = 0;
  for (int i = 1; i <= n; i++) {
    if (st == 0) {
      if (v[i] == k + 1) st = 1;
      if (v[i] > k + 1) st = 2;
    } else if (st == 1) {
      if (v[i] >= k + 1) st = 2;
    }
  }
  if (st == 1)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}
