#include <bits/stdc++.h>
using namespace std;
template <typename T1, typename T2>
inline void chkmin(T1 &x, T2 y) {
  if (y < x) x = y;
};
template <typename T1, typename T2>
inline void chkmax(T1 &x, T2 y) {
  if (y > x) x = y;
};
const int N = 100005;
int n;
set<int> G[N];
int deg[N];
void die() {
  cout << "No\n";
  exit(0);
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL), cout.tie(NULL);
  int k;
  cin >> n >> k;
  for (int i = 0; i < n - 1; ++i) {
    int v, u;
    cin >> v >> u;
    G[v].insert(u);
    G[u].insert(v);
  }
  vector<int> a;
  for (int v = 1; v <= n; ++v) {
    if (G[v].size() == 1) {
      a.push_back(v);
    }
  }
  if (a.empty()) die();
  while (true) {
    k--;
    vector<int> b;
    for (auto e : a) {
      if (G[e].empty()) {
        die();
      }
      int p = *G[e].begin();
      G[p].erase(e);
      deg[p]++;
      b.push_back(p);
    }
    a = vector<int>(b.begin(), b.end());
    sort(a.begin(), a.end());
    a = vector<int>(a.begin(), unique(a.begin(), a.end()));
    for (auto v : a) {
      if (deg[v] < 3) {
        die();
      }
    }
    if (a.size() == 1) {
      break;
    }
  }
  if (k == 0)
    cout << "Yes\n";
  else
    die();
  return 0;
}
