#include <bits/stdc++.h>
using namespace std;
int dist[100005], par[100005];
vector<int> vec[100005];
void dfs1(int s, int pp) {
  par[s] = pp;
  dist[s] = dist[pp] + 1;
  for (int v : vec[s]) {
    if (v == pp) continue;
    dfs1(v, s);
  }
}
bool dfs2(int s, int pp, int hn) {
  if (hn == 0) return (vec[s].size() == 1 && vec[s][0] == pp);
  int cnt = 0;
  int res = 1;
  for (int v : vec[s]) {
    if (v == pp) continue;
    cnt++;
    res &= dfs2(v, s, hn - 1);
  }
  return (res & (cnt >= 3));
}
void prexit() {
  printf("No\n");
  exit(0);
}
int main() {
  int n, k;
  scanf("%d %d", &n, &k);
  for (int i = 1; i < n; i++) {
    int x, y;
    scanf("%d %d", &x, &y);
    vec[x].push_back(y);
    vec[y].push_back(x);
  }
  int root = -1;
  for (int i = 1; i <= n; i++) {
    if (vec[i].size() == 1) {
      root = i;
      break;
    }
  }
  dist[0] = -1;
  dfs1(root, 0);
  int dm = 0, dmn = -1;
  for (int i = 1; i <= n; i++) {
    if (dist[i] > dm) dm = dist[i], dmn = i;
  }
  if (dm != 2 * k) prexit();
  for (int i = 1; i <= k; i++) dmn = par[dmn];
  int ans = dfs2(dmn, 0, k);
  if (ans)
    printf("Yes\n");
  else
    printf("No\n");
  return 0;
}
