#include <bits/stdc++.h>
using namespace std;
long long n, k, u, v, c, t, szs, cc;
vector<long long> adj[100005];
queue<long long> q;
bool vis[100005];
long long chi1[100005], chi2[100005], level[100005];
void bfs() {
  while ((long long)q.size() > 2) {
    szs = (long long)q.size();
    c++;
    for (long long i = 0; i < szs; i++) {
      t = q.front();
      q.pop();
      level[t] = c;
      if (c > 1 && chi1[t] - chi2[t] < 3) {
        cout << "No";
        return;
      }
      for (auto it : adj[t]) {
        chi2[it]--;
        if (level[it] >= level[t]) {
          cout << "No";
          return;
        }
        if (!vis[it]) {
          cc++;
          vis[it] = 1;
          q.push(it);
        }
      }
      adj[t].clear();
    }
  }
  if ((long long)q.size() != 1 || c != k || cc != n)
    cout << "No";
  else
    cout << "Yes";
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n >> k;
  for (long long i = 0; i < n - 1; i++) {
    cin >> u >> v;
    adj[u - 1].push_back(v - 1);
    adj[v - 1].push_back(u - 1);
  }
  memset(level, -1, sizeof(level));
  for (long long i = 0; i < n; i++) {
    chi1[i] = chi2[i] = (long long)adj[i].size();
    if (chi1[i] == 1) q.push(i), vis[i] = 1, cc++;
  }
  bfs();
  return 0;
}
