#include <bits/stdc++.h>
using namespace std;
int n, k;
vector<vector<int> > g;
vector<int> u, d, p;
void df(int v) {
  u[v] = 1;
  for (int i = 0; i < g[v].size(); ++i) {
    int to = g[v][i];
    if (!u[to]) {
      d[to] = d[v] + 1;
      p[to] = v;
      df(to);
    }
  }
}
bool dfs(int v) {
  u[v] = 1;
  if (d[v] > k) return false;
  if (d[v] == 0 && g[v].size() < 3) return false;
  if (d[v] != 0 && d[v] < k && g[v].size() < 4) return false;
  if (d[v] == k && g[v].size() != 1) return false;
  for (int i = 0; i < g[v].size(); ++i) {
    int to = g[v][i];
    if (!u[to]) {
      if (!dfs(to)) return false;
    }
  }
  return true;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin >> n >> k;
  g.resize(n);
  for (int i = 0; i < n - 1; ++i) {
    int a, b;
    cin >> a >> b;
    --a;
    --b;
    g[a].push_back(b);
    g[b].push_back(a);
  }
  if (n == 1) {
    cout << "No";
    return 0;
  }
  int s = 0;
  while (g[s].size() != 1) ++s;
  p.assign(n, s);
  d.assign(n, 0);
  u.assign(n, 0);
  df(s);
  s = 0;
  while (s < n && d[s] != k + k) ++s;
  if (s == n) {
    cout << "No";
    return 0;
  }
  for (int i = 0; i < k; ++i) s = p[s];
  p.assign(n, s);
  d.assign(n, 0);
  u.assign(n, 0);
  df(s);
  u.assign(n, 0);
  cout << (dfs(s) ? "Yes" : "No");
  return 0;
}
