#include <bits/stdc++.h>
using namespace std;
const int N = 1100;
const int MAXN = int(1e6) + 100;
const long long mod = int(1e9) + 7;
int solution();
int main(int argc, char* const argv[]) {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  return solution();
}
int n, k;
bool u[MAXN];
vector<int> G[MAXN], newG[MAXN], graph;
int solution() {
  cin >> n >> k;
  int f, t;
  for (int i = 1; i < n; i++) {
    cin >> f >> t;
    G[f].push_back(t);
    G[t].push_back(f);
    graph.push_back(i);
  }
  graph.push_back(n);
  for (int i = 1; i <= k; i++) {
    bool deleted = false;
    for (auto c : graph) {
      newG[c].clear();
      if (G[c].size() == 1) {
        u[c] = true;
        deleted = true;
        if (G[G[c][0]].size() < 4 - (i == k)) return cout << "No\n", 0;
      }
    }
    if (!deleted) return cout << "No\n", 0;
    vector<int> newGraph;
    for (auto c : graph) {
      if (u[c]) {
        G[c].clear();
        continue;
      }
      newGraph.push_back(c);
      for (auto to : G[c]) {
        if (!u[to]) {
          newG[c].push_back(to);
        }
      }
      for (auto to : G[c]) {
        if (u[to] && newG[c].size() != 1 && i != k) return cout << "No\n", 0;
      }
      G[c] = newG[c];
    }
    graph = newGraph;
  }
  if (graph.size() != 1) return cout << "No\n", 0;
  cout << "Yes\n";
  return 0;
}
