#include <bits/stdc++.h>
using namespace std;
long long n, k, r, second, p[200005], xx, yy, ch[200005];
pair<long long, long long> d[200005];
vector<long long> v[100005];
void go(long long x, long long par) {
  p[x] = par;
  if (v[x].size() == 1 && v[x][0] == par) {
    d[x].first = 0;
    d[x].second = x;
  }
  for (int i = 0; i < v[x].size(); i++) {
    if (v[x][i] != par) {
      go(v[x][i], x);
      if (d[v[x][i]].first + 1 >= d[x].first) {
        d[x].first = d[v[x][i]].first + 1;
        d[x].second = d[v[x][i]].second;
      }
    }
  }
}
void dfs(long long x, long long par, long long dep) {
  if (v[x].size() == 1 && v[x][0] == par) {
    if (dep != k) {
      cout << "No";
      exit(0);
    }
    return;
  }
  for (int i = 0; i < v[x].size(); i++) {
    if (v[x][i] != par) {
      dfs(v[x][i], x, dep + 1);
      ch[x]++;
    }
  }
  if (ch[x] < 3) {
    cout << "No";
    exit(0);
  }
}
int main() {
  cin >> n >> k;
  for (int i = 1; i <= n - 1; i++) {
    cin >> xx >> yy;
    v[xx].push_back(yy);
    v[yy].push_back(xx);
  }
  go(1, -1);
  if (d[1].first < k) {
    cout << "No";
    return 0;
  }
  second = d[1].second;
  r = 0;
  while (r < k) {
    second = p[second];
    r++;
  }
  dfs(second, -1, 0);
  cout << "Yes";
  return 0;
}
