#include <bits/stdc++.h>
using namespace std;
int md;
int mdv;
bool used[200010];
vector<int> e[200010];
int dd[200010];
int dd2[200010];
void dfs(int k, int d) {
  used[k] = true;
  dd[k] = d;
  if (md < d) {
    md = d;
    mdv = k;
  }
  for (int i = 0; i < (int)e[k].size(); i++) {
    if (!used[e[k][i]]) {
      dfs(e[k][i], d + 1);
    }
  }
  return;
}
int main(void) {
  int n, k;
  int x, y;
  int c;
  scanf("%d %d", &n, &k);
  for (int i = 0; i < (int)n - 1; i++) {
    scanf("%d %d", &x, &y);
    e[x - 1].push_back(y - 1);
    e[y - 1].push_back(x - 1);
  }
  md = -1;
  for (int i = 0; i < (int)n; i++) used[i] = false;
  dfs(0, 0);
  md = -1;
  for (int i = 0; i < (int)n; i++) used[i] = false;
  dfs(mdv, 0);
  if (md != (2 * k)) {
    printf("No\n");
    return 0;
  }
  for (int i = 0; i < (int)n; i++) dd2[i] = dd[i];
  md = -1;
  for (int i = 0; i < (int)n; i++) used[i] = false;
  dfs(mdv, 0);
  for (int i = 0; i < (int)n; i++) {
    if (dd[i] == k && dd2[i] == k) {
      c = i;
      break;
    }
  }
  md = -1;
  for (int i = 0; i < (int)n; i++) used[i] = false;
  dfs(c, 0);
  for (int i = 0; i < (int)n; i++) {
    if (i == c) {
      if (e[i].size() < 3) {
        printf("No\n");
        return 0;
      }
    } else {
      if (e[i].size() == 1) {
        if (dd[i] != k) {
          printf("No\n");
          return 0;
        }
      } else if (e[i].size() < 4) {
        printf("No\n");
        return 0;
      }
    }
  }
  printf("Yes\n");
  return 0;
}
