#include <bits/stdc++.h>
using namespace std;
vector<int> arr[100005];
vector<bool> v;
int k;
bool dfs(int curr, int depth) {
  if (depth > k) return false;
  bool f = false;
  for (int i = 0; i < arr[curr].size(); i++) {
    int next = arr[curr][i];
    if (!v[next]) {
      v[next] = true;
      if (!dfs(next, depth + 1)) return false;
      f = true;
    }
  }
  if (!f) {
    return (depth == k);
  }
  return true;
}
int main() {
  int n;
  cin >> n >> k;
  if (n == 1) {
    cout << "No" << endl;
    return 0;
  }
  v.resize(n);
  for (int i = 0; i < n; i++) v[i] = false;
  for (int i = 0; i < n - 1; i++) {
    int a, b;
    scanf("%d%d", &a, &b);
    a--;
    b--;
    arr[a].push_back(b);
    arr[b].push_back(a);
  }
  queue<int> q;
  bool centExists = false;
  for (int i = 0; i < n; i++) {
    if (arr[i].size() == 1) {
      q.push(i);
      v[i] = true;
    } else if (arr[i].size() == 2) {
      cout << "No" << endl;
      return 0;
    } else {
      centExists = true;
    }
  }
  if (!centExists) {
    cout << "No" << endl;
    return 0;
  }
  int center;
  while (!q.empty()) {
    int curr = q.front();
    q.pop();
    for (int i = 0; i < arr[curr].size(); i++) {
      if (!v[arr[curr][i]]) {
        center = arr[curr][i];
        v[arr[curr][i]] = true;
        q.push(arr[curr][i]);
        break;
      }
    }
  }
  for (int i = 0; i < n; i++) {
    if (i != center) {
      if (arr[i].size() != 1 && arr[i].size() < 4) {
        cout << "No" << endl;
        return 0;
      }
    }
  }
  for (int i = 0; i < n; i++) v[i] = false;
  v[center] = true;
  if (dfs(center, 0)) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}
