#include <bits/stdc++.h>
using namespace std;
vector<int> g[100005];
int n, k;
int mark[100005];
int deg[100005];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> k;
  for (int i = 1; i <= n - 1; ++i) {
    int u, v;
    cin >> u >> v;
    g[u].push_back(v);
    g[v].push_back(u);
  }
  if (k >= n || n <= 3) {
    cout << "No\n";
    return 0;
  }
  vector<int> q;
  int rem = n;
  for (int i = 1; i <= n; ++i)
    if (g[i].size() == 1) {
      q.push_back(i);
      mark[i] = 1;
      rem--;
    }
  int steps = 0;
  while (1) {
    if (rem == 0 && q.size() > 1) {
      cout << "No\n";
      return 0;
    }
    if (rem == 0) break;
    vector<int> nxt;
    for (int st : q) {
      for (int v : g[st]) {
        if (!mark[v]) {
          mark[v] = 1;
          nxt.push_back(v);
        }
        deg[v]++;
      }
    }
    for (int v : nxt) {
      if (deg[v] <= 2) {
        cout << "No\n";
        return 0;
      }
    }
    rem -= nxt.size();
    assert(nxt.size() > 0);
    q = nxt;
    steps++;
    if (q.size() == 1) {
      if (rem == 0) break;
      cout << "No\n";
      return 0;
    }
    for (int v : q)
      if (g[v].size() != 1 + deg[v]) {
        cout << "No\n";
        return 0;
      }
  }
  if (steps == k)
    cout << "Yes\n";
  else
    cout << "No\n";
}
