#include <bits/stdc++.h>
using namespace std;
struct edge_t {
  int v, w, next_id;
  edge_t(int _v, int _w, int _next_id) : v(_v), w(_w), next_id(_next_id) {}
};
void add_edge(vector<int>& LE, vector<edge_t>& E, int v, int w) {
  E.push_back(edge_t(v, w, LE[v]));
  LE[v] = E.size() - 1;
}
bool multihedgehog(int n, vector<int>& LE, vector<edge_t>& E,
                   vector<int>& degree, int k) {
  vector<int> parents(n, -1);
  vector<int> labels(n, -1);
  queue<int> q;
  for (int i = 0; i < n; i++) {
    if (degree[i] == 1) {
      labels[i] = 0;
      q.push(i);
    }
  }
  while (!q.empty()) {
    int v = q.front();
    q.pop();
    for (int id = LE[v]; id != -1; id = E[id].next_id) {
      edge_t e = E[id];
      if (parents[e.w] == e.v) {
        continue;
      }
      parents[e.v] = e.w;
      if (labels[e.w] == -1) {
        labels[e.w] = labels[e.v] + 1;
        q.push(e.w);
      } else if (labels[e.w] != labels[e.v] + 1) {
        return false;
      }
    }
  }
  for (int i = 0; i < n; i++) {
    if (labels[i] == 0 && degree[i] != 1) {
      return false;
    }
    if (labels[i] == k && degree[i] < 3) {
      return false;
    }
    if (labels[i] > 0 && labels[i] < k && degree[i] < 4) {
      return false;
    }
  }
  int centers = 0;
  for (int i = 0; i < n; i++) {
    if (labels[i] == k) {
      centers++;
    }
  }
  return centers == 1;
}
int main() {
  ios_base::sync_with_stdio(false);
  int n, k;
  cin >> n >> k;
  vector<int> LE(n, -1);
  vector<edge_t> E;
  vector<int> degree(n);
  for (int i = 0; i < n - 1; i++) {
    int u, v;
    cin >> u >> v;
    u--;
    v--;
    add_edge(LE, E, u, v);
    add_edge(LE, E, v, u);
    degree[u]++;
    degree[v]++;
  }
  if (multihedgehog(n, LE, E, degree, k)) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}
