#include <bits/stdc++.h>
using namespace std;
char _;
long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
long long fpow(long long b, long long exp, long long mod) {
  if (exp == 0) return 1;
  long long t = fpow(b, exp / 2, mod);
  if (exp & 1) return t * t % mod * b % mod;
  return t * t % mod;
}
int num_nodes, K, center, sz[100005], dis[100005], parents[100005], cnt[100005],
    res, prv[100005];
bool vis[100005];
vector<int> connections[100005];
deque<int> leaves;
void getSz(int node, int prev) {
  sz[node] = 1;
  for (int check : connections[node]) {
    if (check == prev) continue;
    getSz(check, node);
    sz[node] += sz[check];
  }
}
int getCentroid(int node, int prev) {
  for (int check : connections[node]) {
    if (check == prev) continue;
    if (sz[check] * 2 > sz[node]) {
      return getCentroid(check, node);
    }
  }
  return node;
}
inline void initLeaves() {
  queue<int> q;
  q.push(center);
  vis[center] = true;
  parents[center] = -1;
  int farthest = 0;
  while (!q.empty()) {
    int node = q.front();
    q.pop();
    farthest = max(farthest, dis[node]);
    for (int check : connections[node]) {
      if (!vis[check]) {
        vis[check] = true;
        dis[check] = dis[node] + 1;
        parents[check] = node;
        q.push(check);
      }
    }
  }
  for (int i = 1; i <= num_nodes; i++)
    if (dis[i] == farthest) leaves.push_back(i);
}
int main() {
  scanf("%d %d", &num_nodes, &K);
  for (int i = 1; i < num_nodes; i++) {
    int first, second;
    scanf(" %d %d", &first, &second);
    connections[first].push_back(second);
    connections[second].push_back(first);
  }
  deque<int> q;
  int last = 0;
  memset(dis, 0x3f, sizeof dis);
  for (int i = 1; i <= num_nodes; i++) {
    if (connections[i].size() == 1) {
      leaves.push_back(i);
      q.push_back(i);
      vis[i] = true;
      dis[i] = 0;
    }
  }
  while (q.size() > 1) {
    int n = (int)q.size();
    memset(vis, false, sizeof vis);
    for (int i = 0; i < n; i++) {
      for (int check : connections[q[0]]) {
        if (!vis[check] && dis[check] > dis[q[0]]) {
          vis[check] = true;
          dis[check] = dis[q[0]] + 1;
          q.push_back(check);
        } else if (!vis[check] && dis[check] == dis[q[0]]) {
          printf("No\n");
          return 0;
        }
        cnt[check]++;
      }
      q.pop_front();
    }
    for (int check : q) {
      if (cnt[check] < 3) {
        printf("No\n");
        return 0;
      }
    }
    res++;
  }
  if (q.size() == 1 && res == K)
    printf("Yes\n");
  else
    printf("No\n");
}
