#include <bits/stdc++.h>
using namespace std;
int p[100000];
int find(int x) { return x == p[x] ? x : (p[x] = find(p[x])); }
void unite(int a, int b) {
  if (a % 2 == 0) swap(a, b);
  p[find(a)] = find(b);
}
int main(int argc, char *argv[]) {
  ios::sync_with_stdio(false);
  int N, K;
  cin >> N >> K;
  vector<set<int>> g(N);
  for (int i = 1; i < N; i++) {
    int a, b;
    cin >> a >> b;
    a--;
    b--;
    g[a].insert(b);
    g[b].insert(a);
  }
  int ans = 0, pans = 0;
  while (K--) {
    iota(begin(p), begin(p) + N, 0);
    for (int i = 0; i < g.size(); i++)
      for (int j : g[i]) unite(i, j);
    int t = -1;
    for (int i = 0; i < N; i++)
      if (find(i) != i) t = find(i);
    if (t < 0) {
      cout << "No" << endl;
      return 0;
    }
    for (int i = 0; i < N; i++)
      if (find(i) != t and find(i) != i) {
        cout << "No" << endl;
        return 0;
      }
    vector<size_t> sz;
    for (int i = 0; i < N; i++) sz.push_back(g[i].size());
    vector<int> cnt(N, 0);
    for (int i = 0; i < N; i++) {
      if (sz[i] == 2) {
        cout << "No" << endl;
        return 0;
      } else if (sz[i] == 1) {
        cnt[*g[i].begin()]++;
        g[*g[i].begin()].erase(i);
        g[i].clear();
        ans++;
      }
    }
    for (int i : cnt)
      if (i < 3 and i > 0) {
        cout << "No" << endl;
        return 0;
      }
    if (ans - pans < 3) {
      cout << "No" << endl;
      return 0;
    }
    pans = ans;
  }
  cout << (ans == N - 1 ? "Yes" : "No") << endl;
  return 0;
}
