#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 10;
vector<int> G[maxn];
int ru[maxn];
int cnt[maxn];
bool visit[maxn];
int main() {
  ios::sync_with_stdio(0);
  int n, k;
  cin >> n >> k;
  for (int i = 1; i <= n - 1; i++) {
    int a, b;
    cin >> a >> b;
    G[a].push_back(b);
    G[b].push_back(a);
    ru[a]++;
    ru[b]++;
  }
  for (int i = 1; i <= k; i++) {
    memset(cnt, 0, sizeof cnt);
    for (int j = 1; j <= n; j++) {
      if (ru[j] == 1) {
        int len = G[j].size();
        int t;
        for (int l = 0; l <= len - 1; l++) {
          t = G[j][l];
          if (visit[t] != 1) {
            break;
          }
        }
        cnt[t]++;
        ru[j]--;
        visit[j] = true;
      }
    }
    int num = 0;
    for (int j = 1; j <= n; j++) ru[j] -= cnt[j];
    for (int j = 1; j <= n; j++) {
      if (cnt[j] != 0) {
        num++;
        if (cnt[j] < 3) {
          cout << "NO" << endl;
          return 0;
        }
      }
    }
    if (num < 3 && i != k) {
      cout << "No" << endl;
      return 0;
    }
    if (i == k) {
      if (num != 1) {
        cout << "No" << endl;
        return 0;
      }
    }
  }
  cout << "Yes" << endl;
}
