#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int MOD = 998244353;
const int MAXN = (int)1e5 + 5;
int n, k;
vector<int> e[MAXN];
int deg[MAXN], used[MAXN];
int main() {
  cin >> n >> k;
  int a, b;
  for (int i = 0; i < n - 1; ++i) {
    scanf("%d%d", &a, &b);
    e[a].push_back(b);
    e[b].push_back(a);
    deg[a]++;
    deg[b]++;
  }
  vector<int> q;
  for (int i = 1; i <= n; ++i)
    if (deg[i] == 2) {
      cout << "No";
      return 0;
    } else if (deg[i] == 1)
      q.push_back(i);
  int rem = n;
  while (rem > 4 && k > 1) {
    set<int> touched;
    for (int x : q) {
      for (int v : e[x])
        if (!used[v]) {
          if (!touched.count(v) && deg[v] < 4) {
            cout << "No";
            return 0;
          }
          touched.insert(v);
          deg[v]--;
        }
      used[x] = 1;
      rem--;
    }
    q.clear();
    for (int x : touched)
      if (deg[x] > 1) {
        cout << "No";
        return 0;
      } else
        q.push_back(x);
    k--;
  }
  if (k == 1 && rem >= 4) {
    set<int> touched;
    for (int x : q)
      for (int v : e[x])
        if (!used[v]) touched.insert(v);
    if (touched.size() == 1)
      cout << "Yes";
    else
      cout << "No";
  } else
    cout << "No";
  return 0;
}
