#include <bits/stdc++.h>
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int grand(int x) { return uniform_int_distribution<int>(0, x - 1)(rng); }
const int maxn = 1e6 + 7;
const long long inf = 1e15;
const long long md = 1e9 + 7;
const string NO = "No";
const string YES = "Yes";
long long gcd(long long x, long long y) {
  if (x < y) return gcd(y, x);
  if (y == 0) return x;
  return gcd(y, x % y);
}
vector<int> G[maxn];
vector<int> path;
int K;
bool ok = false;
int deg[maxn];
void dfs(int x, int pi, int m) {
  if (ok) return;
  path.push_back(x);
  if (path.size() == K + K + 1) {
    ok = true;
    return;
  }
  for (int y : G[x]) {
    if (y == pi) continue;
    dfs(y, x, m + 1);
  }
  path.pop_back();
}
void nope() {
  cout << NO << "\n";
  exit(0);
}
void yeah() {
  cout << YES << "\n";
  exit(0);
}
void go(int x, int pi, int h) {
  if (h == K) {
    if (deg[x] != 1) nope();
    return;
  }
  int ed = deg[x];
  if (pi > 0) ed--;
  if (ed < 3) nope();
  for (int y : G[x]) {
    if (y == pi) continue;
    go(y, x, h + 1);
  }
}
int main() {
  {
    ios ::sync_with_stdio(false);
    cin.tie(0);
  };
  int n;
  cin >> n >> K;
  fill(deg, deg + maxn, 0);
  for (int j = 1; j < n; j++) {
    int x, y;
    cin >> x >> y;
    G[x].push_back(y);
    G[y].push_back(x);
    deg[x]++;
    deg[y]++;
  }
  int z = -1;
  for (int i = 1; i <= n; i++) {
    if (deg[i] == 1) {
      z = i;
      break;
    }
  }
  path.clear();
  dfs(z, -1, 1);
  if (!ok) {
    nope();
  }
  int v = path[K];
  go(v, -1, 0);
  yeah();
}
