#include <bits/stdc++.h>
using namespace std;
const int N = 100001;
int deg[N], n, k;
bool rem[N];
vector<int> adjList[N];
int main() {
  int k;
  scanf("%d%d", &n, &k);
  for (int i = 1; i < n; i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    adjList[x].push_back(y);
    adjList[y].push_back(x);
    deg[x]++, deg[y]++;
  }
  vector<int> nodes;
  for (int i = 1; i <= n; i++)
    if (deg[i] == 1) nodes.push_back(i);
  while (k) {
    if (nodes.size() < 3) return printf("No"), 0;
    vector<int> nw;
    map<int, int> mp;
    for (int node : nodes) {
      for (int ch : adjList[node]) {
        if (rem[ch]) continue;
        mp[ch]++;
        deg[ch]--;
      }
      rem[node] = true;
    }
    for (pair<int, int> p : mp) {
      if (p.second < 3) return printf("No"), 0;
      if (k > 1) {
        if (deg[p.first] != 1) return printf("No"), 0;
      } else {
        if (deg[p.first]) return printf("No"), 0;
      }
      nw.push_back(p.first);
    }
    nodes = nw;
    k--;
  }
  if (nodes.size() == 1 && !deg[nodes.back()])
    printf("Yes");
  else
    printf("No");
  return 0;
}
