#include <bits/stdc++.h>
using namespace std;
vector<set<int> > gr;
vector<vector<int> > gr1;
int deg[300010];
queue<int> ls;
bool iskhg(int u, int k, int par) {
  if (k < 0) {
    return 0;
  }
  if (gr1[u].size() == 1) {
    return k == 0;
  }
  bool res;
  if (par == -1) {
    res = deg[u] > 2;
  } else
    res = deg[u] > 3;
  for (auto i : gr1[u]) {
    if (i != par) {
      res &= iskhg(i, k - 1, u);
    }
  }
  return res;
}
int main() {
  int n, k;
  cin >> n >> k;
  set<int> si;
  vector<int> vi;
  gr.resize(n + 1, si);
  gr1.resize(n + 1, vi);
  for (int i = 0; i < n - 1; ++i) {
    int u, v;
    cin >> u >> v;
    gr[u].insert(v);
    gr[v].insert(u);
    gr1[u].push_back(v);
    gr1[v].push_back(u);
    deg[u]++;
    deg[v]++;
  }
  for (int i = 1; i < n + 1; ++i) {
    if (deg[i] == 2 or deg[i] < 1) {
      cout << "No\n";
      return 0;
    } else if (deg[i] == 1) {
      ls.push(i);
    }
  }
  int k1 = 0, dg1 = ls.size(), dg2 = 0, root = 0;
  while (!ls.empty()) {
    int tmp = ls.front();
    if (gr[tmp].size() == 0) {
      root = tmp;
      ls.pop();
      continue;
    }
    int ng = *gr[tmp].begin();
    ls.pop();
    gr[tmp].erase(ng);
    gr[ng].erase(tmp);
    --dg1;
    ++dg2;
    if (!dg1) {
      ++k1;
      dg1 = dg2;
      dg2 = 0;
    }
    ls.push(ng);
  }
  if (iskhg(root, k, -1)) {
    cout << "Yes\n";
  } else {
    cout << "No\n";
  }
  return 0;
}
