#include <bits/stdc++.h>
using namespace std;
const int mod = 998244353;
const int inf = 0x3f3f3f3f;
long long gcd(long long x, long long y) {
  if (y == 0)
    return x;
  else
    return gcd(y, x % y);
}
long long ksm(long long a, long long b) {
  long long r = 1;
  while (b) {
    if (b & 1) r = (r * a) % mod;
    a = a * a % mod;
    b >>= 1;
  }
  return r;
}
void exgcd(long long a, long long b, long long &x, long long &y, long long &d) {
  if (!b)
    d = a, x = 1, y = 0;
  else
    exgcd(b, a % b, y, x, d), y -= a / b * x;
}
long long inv(long long a, long long p) {
  long long x, y, d;
  exgcd(a, p, x, y, d);
  x = (x % p + p) % p;
  return x;
}
inline int read() {
  char c = getchar();
  int x = 0, f = 1;
  while (c < '0' || c > '9') {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') {
    x = x * 10 + c - '0';
    c = getchar();
  }
  return x * f;
}
const int maxn = 1e5 + 100;
int n, m, k, t, in[maxn], rk[maxn], w[maxn];
vector<int> g[maxn];
queue<int> q;
int main() {
  cin >> n >> k;
  memset(rk, -1, sizeof(rk));
  for (int i = 1; i < n; i++) {
    int u, v;
    cin >> u >> v;
    g[u].push_back(v);
    g[v].push_back(u);
    in[v]++, in[u]++;
  }
  for (int i = 1; i <= n; i++) {
    if (in[i] == 1) {
      q.push(i);
      rk[i] = 0;
    }
  }
  int ok = 0;
  int cnt = 0;
  while (!q.empty()) {
    int u = q.front();
    q.pop();
    cnt++;
    for (int v : g[u]) {
      if (in[v] == 1 && rk[v] < rk[u]) continue;
      in[v]--;
      w[v]++;
      if (rk[v] == -1)
        rk[v] = rk[u] + 1;
      else if (rk[v] != rk[u] + 1) {
        puts("No");
        return 0;
      }
      if ((in[v] == 1 && rk[v] != k) || (in[v] == 0 && rk[v] == k)) q.push(v);
    }
  }
  for (int i = 1; i <= n; i++) {
    if (rk[i] == k) ok++;
    if (rk[i] >= 1 && w[i] < 3) ok = 100;
  }
  if (ok == 1 && cnt == n)
    puts("Yes");
  else
    puts("No");
  return 0;
}
