#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100005;
bool vis[MAXN];
bool inQueue[MAXN];
int layer[MAXN];
int sons[MAXN];
bool yes = true;
vector<int> graph[MAXN];
int main() {
  int ans = 0, n, k;
  scanf("%d%d", &n, &k);
  queue<int> que;
  for (int i = 0; i < n - 1; i++) {
    int u, v;
    scanf("%d%d", &u, &v);
    graph[u].push_back(v);
    graph[v].push_back(u);
  }
  for (int i = 1; i <= n; i++) {
    if (graph[i].size() == 1) {
      que.push(i);
    }
  }
  int nums = 0;
  while (!que.empty()) {
    int u = que.front();
    vis[u] = true;
    nums++;
    que.pop();
    if (sons[u] < 3 && layer[u] != 0) {
      yes = false;
      break;
    }
    int cnt = 0;
    int v = 0;
    for (int i = 0; i < graph[u].size(); i++) {
      if (!vis[graph[u][i]]) {
        cnt++;
        v = graph[u][i];
      }
    }
    if (cnt != 1 && nums != n) {
      yes = false;
      break;
    }
    if (v == 0) {
      break;
    }
    if (layer[v] != 0 && layer[v] != layer[u] + 1) {
      yes = false;
      break;
    }
    layer[v] = layer[u] + 1;
    ans = max(ans, layer[v]);
    sons[v]++;
    if (!inQueue[v]) {
      que.push(v);
      inQueue[v] = true;
    }
  }
  if (!yes || ans != k) {
    cout << "No" << endl;
  } else {
    cout << "Yes" << endl;
  }
  return 0;
}
