#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
map<int, int> d2;
vector<int> g[N];
bool ok = true;
int k;
int mx_dist_val = -1;
int mx_dist_idx = -1;
vector<int> final_path;
void dfs(int v, int d, int p = -1) {
  if (d > mx_dist_val) {
    mx_dist_val = d;
    mx_dist_idx = v;
  }
  for (int u : g[v]) {
    if (u != p) {
      dfs(u, d + 1, v);
    }
  }
}
void dfs2(int v, int end, vector<int> &path, int p = -1) {
  if (v == end) {
    final_path = path;
  }
  for (int u : g[v]) {
    if (u != p) {
      path.push_back(u);
      dfs2(u, end, path, v);
      path.pop_back();
    }
  }
}
void dfs3(int v, int d = 0, int p = -1) {
  if (d == 0 && g[v].size() < 3) {
    ok = false;
  } else if (d > 0 && d < k && g[v].size() <= 3) {
    ok = false;
  } else if (d == k && g[v].size() != 1) {
    ok = false;
  }
  for (int u : g[v]) {
    if (u != p) {
      dfs3(u, d + 1, v);
    }
  }
}
int main() {
  int n;
  scanf("%d %d", &n, &k);
  for (int i = 0; i < n - 1; i++) {
    int a, b;
    scanf("%d %d", &a, &b);
    g[a].push_back(b);
    g[b].push_back(a);
  }
  int st = -1;
  for (int i = 1; i <= n; i++) {
    if (g[i].size() == 1) {
      st = i;
      dfs(i, 0);
      break;
    }
  }
  if (mx_dist_val != 2 * k) {
    printf("No\n");
    return 0;
  }
  vector<int> path;
  path.push_back(st);
  dfs2(st, mx_dist_idx, path);
  int center = final_path[k];
  dfs3(center);
  if (ok) {
    printf("Yes\n");
  } else {
    printf("No\n");
  }
}
