#include <bits/stdc++.h>
using namespace std;
long long int n, k, l;
vector<vector<long long int> > adj;
vector<long long int> level;
vector<long long int> d;
long long int distance(long long int x) {
  long long int last = x;
  for (long long int j = 1; j <= n; j++) d[j] = INT_MAX;
  queue<long long int> q;
  q.push(x);
  d[x] = 0;
  while (!q.empty()) {
    long long int node = q.front();
    q.pop();
    for (long long int i = 0; i < adj[node].size(); i++) {
      long long int neigh = adj[node][i];
      if (d[neigh] > d[node] + 1) {
        d[neigh] = d[node] + 1;
        q.push(neigh);
        last = neigh;
      }
    }
  }
  return last;
}
int main(void) {
  long long int i, a, b;
  cin >> n >> k;
  adj.resize(n + 1);
  d.resize(n + 1);
  level.resize(n + 1);
  long long int center = 0;
  for (i = 1; i < n; i++) {
    cin >> a >> b;
    adj[a].push_back(b);
    adj[b].push_back(a);
  }
  long long int x = distance(1);
  long long int y = distance(x);
  vector<long long int> d1(n + 1);
  d1 = d;
  long long int z = distance(y);
  long long int ans = 1;
  if (d1[y] % 2 == 1 || k > n / 2) {
    cout << "No\n";
    return 0;
  }
  for (i = 1; i <= n; i++) {
    if (d[i] == d1[i] && d[i] == ((d1[y]) / 2) && adj[i].size() >= 3) {
      center = i;
      break;
    }
  }
  if (center == 0) {
    cout << "No\n";
    return 0;
  }
  for (i = 1; i <= n; i++) level[i] = 0;
  level[center] = 1;
  queue<long long int> q;
  q.push(center);
  while (!q.empty()) {
    long long int x = q.front();
    q.pop();
    for (long long int i = 0; i < adj[x].size(); i++) {
      long long int neigh = adj[x][i];
      if (level[neigh] == 0) {
        q.push(neigh);
        level[neigh] = level[x] + 1;
      }
    }
    if (level[x] > k && adj[x].size() != 1) {
      cout << "No\n";
      return 0;
    }
    if (x == center && adj[x].size() < 3) {
      cout << "No\n";
      return 0;
    }
    if (level[x] > 1 && level[x] < k + 1 && adj[x].size() < 4) {
      cout << "No\n";
      return 0;
    }
  }
  cout << "Yes\n";
  return 0;
}
