#include <bits/stdc++.h>
using namespace std;
const int inf = 1e9, maxn = 1e5 + 213, N = 4e6 + 20, mod = 998244353;
const int dx[] = {1, -1, 0, 0}, dy[] = {0, 0, 1, -1};
const double eps = 1e-5, pi = 3.14159265359;
const pair<unsigned long long, unsigned long long> base = make_pair(1171, 3307);
const long long INF = 1e18;
int n, k, v, u, sz[maxn], c[maxn], m;
vector<int> g[maxn];
bool used[maxn];
void dfs(int v, int p = 0) {
  if (sz[v] == 1) {
    --sz[p];
    ++c[p];
    used[v] = 1;
    m--;
    return;
  }
  for (auto to : g[v]) {
    if (to == p) continue;
    dfs(to, v);
  }
}
int main() {
  cin >> n >> k;
  for (int i = (1); i <= (n - 1); ++i) {
    cin >> v >> u;
    g[v].push_back(u);
    g[u].push_back(v);
    ++sz[v], ++sz[u];
  }
  m = n;
  while (1) {
    --k;
    if (!k) {
      int v = 1;
      while (sz[v] == 1 && v <= n) ++v;
      if (v == n + 1 || sz[v] <= 2) {
        cout << "No\n";
        return 0;
      }
      used[v] = 1;
      for (int to : g[v]) used[to] = 1;
      for (int i = (1); i <= (n); ++i)
        if (!used[i]) {
          cout << "No\n";
          return 0;
        }
      cout << "Yes\n";
      return 0;
    }
    memset(c, 0, sizeof(c));
    int v = 1;
    while (used[v] || sz[v] == 1 && v <= n) ++v;
    if (v == n + 1 || m < 4) {
      cout << "No\n";
      return 0;
    }
    dfs(v);
    for (int i = (1); i <= (n); ++i)
      if (!used[i] && c[i] < 3 && c[i]) {
        cout << "No\n";
        return 0;
      }
  }
  return 0;
}
