#include <bits/stdc++.h>
#pragma optimize("Ofast")
using namespace std;
const int N = (int)1e5 + 10;
vector<int> g[N];
int deg[N];
int level[N];
int k;
void dfs(int v, int p = -1, int depth = 0) {
  if (g[v].size() < 3 && !depth) {
    cout << "No";
    exit(0);
  }
  if ((g[v].size() == 3 || g[v].size() == 2) && depth) {
    cout << "No";
    exit(0);
  }
  int cnt = 0;
  for (int u : g[v]) {
    if (u != p) {
      dfs(u, v, depth + 1);
      ++cnt;
    }
  }
  if (!cnt && depth != k) {
    cout << "No";
    exit(0);
  }
}
signed main() {
  ios_base ::sync_with_stdio(false);
  cin.tie(0);
  int n, ml = -1;
  cin >> n >> k;
  if (n < 4) {
    cout << "No";
    return 0;
  }
  for (int i = 0; i < n - 1; ++i) {
    int u, v;
    cin >> u >> v;
    --u;
    --v;
    g[u].push_back(v);
    g[v].push_back(u);
    deg[v]++;
    deg[u]++;
  }
  queue<int> Q;
  for (int i = 0; i < n; ++i) {
    if (deg[i] == 1) Q.push(i);
  }
  while (!Q.empty()) {
    int v = Q.front();
    Q.pop();
    for (int i : g[v]) {
      --deg[i];
      if (deg[i] == 1) {
        level[i] = level[v] + 1;
        Q.push(i);
        ml = max(level[i], ml);
      }
    }
  }
  for (int i = 0; i < n; ++i) {
    if (level[i] == ml) {
      dfs(i);
    }
  }
  cout << "Yes";
  return 0;
}
