#include <bits/stdc++.h>
using namespace std;
int n, k;
vector<int> graph[100009];
int level[100009];
int pp[100009];
void dfs1(int u, int par) {
  for (int i = 0; i < graph[u].size(); i++) {
    int v = graph[u][i];
    if (v == par) continue;
    pp[v] = u;
    level[v] = level[u] + 1;
    dfs1(v, u);
  }
  return;
}
bool flag = 1;
void dfs2(int u, int par) {
  if (graph[u].size() == 1 && par != -1) {
    if (level[u] != k) flag = 0;
    return;
  }
  if (graph[u].size() < 4 && par != -1) flag = 0;
  if (par == -1 && graph[u].size() < 3) flag = 0;
  for (int i = 0; i < graph[u].size(); i++) {
    int v = graph[u][i];
    if (v == par) continue;
    level[v] = level[u] + 1;
    dfs2(v, u);
  }
}
int main() {
  scanf("%d %d", &n, &k);
  int x, y;
  for (int i = 1; i < n; i++) {
    scanf("%d %d", &x, &y);
    graph[x].push_back(y);
    graph[y].push_back(x);
  }
  if (k >= n || n < 4) {
    cout << "No" << endl;
    return 0;
  }
  level[1] = 0;
  dfs1(1, -1);
  int mx = -1;
  for (int i = 1; i <= n; i++) {
    if (level[i] > mx) {
      mx = level[i];
      x = i;
    }
  }
  level[x] = 0;
  pp[x] = -1;
  dfs1(x, -1);
  mx = -1;
  for (int i = 1; i <= n; i++) {
    if (level[i] > mx) {
      mx = level[i];
      y = i;
    }
  }
  if (mx != 2 * k) {
    cout << "No" << endl;
    return 0;
  }
  while (level[y] != k) y = pp[y];
  level[y] = 0;
  dfs2(y, -1);
  if (flag)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  return 0;
}
