#include <bits/stdc++.h>
using namespace std;
int k, n, root, par[100005];
vector<int> v[100005];
bool vis[100005], fr;
void findroot(int u, int l) {
  int i;
  if (v[u].size() == 1 && l == 2 * k) {
    fr = true;
    root = u;
  }
  for (i = 0; i < v[u].size(); i++) {
    if (fr) break;
    if (!vis[v[u][i]]) {
      vis[v[u][i]] = true;
      par[v[u][i]] = u;
      findroot(v[u][i], l + 1);
    }
  }
}
void dfs(int u, int l) {
  int i;
  if (v[u].size() == 1 && l != k) fr = true;
  if (u != root && l != k && v[u].size() < 4) fr = true;
  for (i = 0; i < v[u].size(); i++) {
    if (fr) break;
    if (!vis[v[u][i]]) {
      vis[v[u][i]] = true;
      dfs(v[u][i], l + 1);
    }
  }
}
int main() {
  int i, x, y, leaf, cnt = 0;
  cin >> n >> k;
  for (i = 0; i < n - 1; i++) {
    cin >> x >> y;
    v[x].push_back(y);
    v[y].push_back(x);
  }
  if (n == 1) {
    cout << "No\n";
    return 0;
  }
  for (i = 1; i <= n; i++)
    if (v[i].size() == 1) {
      leaf = i;
      break;
    }
  memset(vis, false, sizeof(vis));
  vis[leaf] = true;
  fr = false;
  findroot(leaf, 0);
  if (!fr) {
    cout << "No\n";
    return 0;
  }
  while (cnt != k) {
    root = par[root];
    cnt++;
  }
  if (v[root].size() < 3) {
    cout << "No\n";
    return 0;
  }
  memset(vis, false, sizeof(vis));
  vis[root] = true;
  fr = false;
  dfs(root, 0);
  if (fr) {
    cout << "No\n";
  } else
    cout << "Yes\n";
  return 0;
}
