#include <bits/stdc++.h>
using namespace std;
int cnt[100100];
int d[100100];
queue<int> qu;
vector<int> a[100010];
int main() {
  int n, k, x, y, last, must_cen = 0;
  cin >> n >> k;
  for (int i = 1; i < n; i++) {
    cin >> x >> y;
    cnt[x]++;
    cnt[y]++;
    a[x].push_back(y);
    a[y].push_back(x);
  }
  for (int i = 1; i <= n; i++) {
    if (cnt[i] == 1) {
      d[i] = 1;
      qu.push(i);
    } else if (cnt[i] == 2) {
      cout << "NO";
      exit(0);
    } else if (cnt[i] == 3) {
      if (must_cen) {
        cout << "No";
        exit(0);
      }
      must_cen = i;
    }
  }
  int dem = 0, ok;
  while (!qu.empty()) {
    dem++;
    x = qu.front();
    qu.pop();
    last = d[x];
    if (must_cen == x)
      ok = true;
    else
      ok = false;
    if (last != d[x]) {
    }
    for (int i = 0; i < a[x].size(); i++) {
      cnt[a[x][i]]--;
      if (d[a[x][i]] != 0 && d[a[x][i]] != d[x] + 1) {
        cout << "No";
        exit(0);
      } else
        d[a[x][i]] = d[x] + 1;
      if (cnt[a[x][i]] == 1) {
        qu.push(a[x][i]);
      }
    }
    d[x] += 2;
  }
  if (last - 1 == k && dem == n && (ok == 1 || must_cen == 0))
    cout << "Yes";
  else
    cout << "No";
}
