#include <bits/stdc++.h>
using namespace std;
int n, k;
vector<int> adj[200013];
int parent[200013];
pair<int, int> findFarthestNode(int cur, int par) {
  parent[cur] = par;
  pair<int, int> best = make_pair(cur, 0);
  for (int next : adj[cur]) {
    if (next == par) continue;
    pair<int, int> temp = findFarthestNode(next, cur);
    temp.second++;
    if (temp.second > best.second) {
      best = temp;
    }
  }
  return best;
}
bool validate(int cur, int par, int depth) {
  if (depth > k) return false;
  if (depth < k && adj[cur].size() < 4 - (depth == 0 ? 1 : 0)) return false;
  if (depth == k && adj[cur].size() != 1) return false;
  if (depth == k && adj[cur].size() == 1) return true;
  bool answer = true;
  for (int next : adj[cur]) {
    if (next == par) continue;
    answer &= validate(next, cur, depth + 1);
  }
  return answer;
}
int main() {
  if (fopen("FILENAME.in", "r")) {
    freopen("FILENAME.in", "r", stdin);
    freopen("FILENAME.out", "w", stdout);
  }
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n >> k;
  for (int i = 0; i < n - 1; i++) {
    int a, b;
    cin >> a >> b;
    a--;
    b--;
    adj[a].push_back(b);
    adj[b].push_back(a);
  }
  pair<int, int> firstNode = findFarthestNode(0, -1);
  pair<int, int> secondNode = findFarthestNode(firstNode.first, -1);
  if (secondNode.second != 2 * k) {
    cout << "No" << endl;
    return 0;
  }
  int root = secondNode.first;
  for (int i = 0; i < k; i++) {
    root = parent[root];
  }
  if (validate(root, -1, 0)) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}
