#include <bits/stdc++.h>
using namespace std;
const long long mod = 998244353ll;
const long long N = 100050;
long long n, k;
vector<long long> g[N];
stack<long long> path;
long long beginn, endd;
long long maxx = 0;
void diameter(long long node, long long par, long long dist) {
  for (auto a : g[node]) {
    if (a != par) diameter(a, node, dist + 1);
  }
  if (dist >= maxx) {
    maxx = dist;
    beginn = node;
  }
}
void diameter1(long long node, long long par, long long dist) {
  for (auto a : g[node]) {
    if (a != par) diameter1(a, node, dist + 1);
  }
  if (dist >= maxx) {
    maxx = dist;
    endd = node;
  }
}
bool find_path(long long node, long long par, long long dest) {
  path.push(node);
  if (node == dest) return 1;
  for (auto a : g[node]) {
    if (a == par) continue;
    if (find_path(a, node, dest)) return 1;
  }
  path.pop();
  return 0;
}
long long find_root() {
  diameter(1, -1, 0);
  diameter1(beginn, -1, 0);
  find_path(beginn, -1, endd);
  long long kk = k;
  while (kk-- && !path.empty()) {
    path.pop();
  }
  return path.empty() ? -1 : path.top();
}
bool check(long long node, long long par, long long d) {
  if (par == -1) {
    if (g[node].size() < 3) return 0;
  } else {
    if (g[node].size() < 4 && g[node].size() != 1) return 0;
  }
  if (g[node].size() == 1) {
    if (d != k) return 0;
  }
  for (auto a : g[node]) {
    if (a == par) continue;
    if (!check(a, node, d + 1)) return 0;
  }
  return 1;
}
signed main() {
  ios::sync_with_stdio(0);
  cin >> n >> k;
  for (long long i = 0; i < n - 1; i++) {
    long long u, v;
    cin >> u >> v;
    g[u].push_back(v);
    g[v].push_back(u);
  }
  long long root = find_root();
  if (root != -1 && check(root, -1, 0))
    cout << "Yes";
  else
    cout << "No";
  return 0;
}
