#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e5 + 11;
int n, k;
vector<int> g[MAXN];
int deg[MAXN], d[MAXN], cnt[MAXN];
bool visited[MAXN];
int main() {
  scanf("%d%d", &n, &k);
  int u, v;
  for (int i = 0; i < n - 1; i++) {
    scanf("%d%d", &u, &v);
    g[u].push_back(v);
    g[v].push_back(u);
    deg[u]++;
    deg[v]++;
  }
  queue<int> q;
  for (int i = 1; i <= n; i++)
    if (deg[i] == 1) q.push(i);
  while (!q.empty()) {
    int ind = q.front();
    q.pop();
    visited[ind] = true;
    if (d[ind] > 0 && cnt[ind] < 3) {
      cout << "No";
      return 0;
    }
    for (auto v : g[ind]) {
      if (visited[v]) continue;
      if (d[v] == 0)
        d[v] = d[ind] + 1;
      else if (d[v] != d[ind] + 1) {
        cout << "No";
        return 0;
      }
      cnt[v]++;
      if (--deg[v] == 1) q.push(v);
    }
  }
  puts(*max_element(d, d + n) == k ? "Yes" : "No");
  return 0;
}
