#include <bits/stdc++.h>
using namespace std;
int cd, k, deg[100005], dep[100005];
set<int> edge[100005];
vector<int> block[100005], edge2[100005], ruler;
void dfs(int u, int pre) {
  block[dep[u]].push_back(u);
  for (auto v : edge2[u]) {
    if (v != pre) {
      dep[v] = dep[u] + 1;
      dfs(v, u);
    }
  }
}
int main() {
  cin >> cd >> k;
  for (int i = 1; i < cd; i++) {
    int u, v;
    cin >> u >> v;
    edge[u].insert(v);
    edge[v].insert(u);
    deg[u]++;
    edge2[u].push_back(v);
    edge2[v].push_back(u);
    deg[v]++;
  }
  for (int i = 1; i <= cd; i++) {
    if (deg[i] == 1) {
      ruler.push_back(i);
    }
  }
  int root = 0;
  for (int i = 1; i <= k; i++) {
    vector<int> tmp;
    if (ruler.size() == 0) {
      cout << "No" << '\n';
      return 0;
    }
    for (auto u : ruler) {
      for (auto v : edge[u]) {
        if (deg[v] < 3) {
          cout << "No" << '\n';
          return 0;
        }
        edge[v].erase(u);
      }
    }
    for (auto u : ruler) {
      for (auto v : edge[u]) {
        if (edge[v].size() == 1) {
          tmp.push_back(v);
        }
        if (edge[v].size() == 0) {
          root = v;
        }
      }
    }
    ruler.clear();
    while (tmp.size() != 0) {
      ruler.push_back(tmp.back());
      tmp.pop_back();
    }
  }
  dfs(root, root);
  for (int i = 1; i <= cd; i++) {
    int deg0 = 0, deg3 = 0;
    for (auto u : block[i]) {
      if (deg[u] > 3) {
        deg3++;
      } else if (deg[u] == 1) {
        deg0++;
      } else {
        cout << "No";
        return 0;
      }
    }
    if (deg[root] < 3 || (deg3 != 0 && deg0 != 0)) {
      cout << "No";
      return 0;
    }
  }
  cout << "Yes" << '\n';
}
