#include <bits/stdc++.h>
using namespace std;
int constexpr N = 100005;
int n, k;
vector<vector<int>> g(N);
int center = -1;
bool dfs(int u, int p = -1, int l = 0) {
  if (l == 2 * k && g[u].size() == 1) return true;
  bool res = false;
  for (int v : g[u])
    if (v != p) {
      res |= dfs(v, u, l + 1);
      if (res && l == k) center = u;
    }
  return res;
}
bool ok = true;
void dfs2(int u, int p = -1, int l = 0) {
  if (l > k) {
    ok = false;
  }
  if (u == center) {
    ok &= (g[u].size() >= 3);
  }
  if (u != center) {
    if (l == k)
      ok &= (g[u].size() == 1);
    else
      ok &= (g[u].size() >= 4);
  }
  for (int v : g[u])
    if (v != p) {
      dfs2(v, u, l + 1);
    }
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> k;
  for (int i = 0, u, v; i < n - 1; ++i) {
    cin >> u >> v;
    g[u].push_back(v);
    g[v].push_back(u);
  }
  for (int i = 1; i <= n; ++i)
    if (g[i].size() == 1) {
      dfs(i);
      break;
    }
  if (center == -1) cout << "No" << endl, exit(0);
  dfs2(center);
  cout << (ok ? "Yes" : "No") << endl;
}
