#include <bits/stdc++.h>
using namespace std;
vector<vector<int> > g;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n, k;
  cin >> n >> k;
  g.resize(n);
  for (int i = 0; i < n - 1; ++i) {
    int a, b;
    cin >> a >> b;
    a--;
    b--;
    g[a].push_back(b);
    g[b].push_back(a);
  }
  queue<pair<int, int> > q;
  vector<int> vis(n);
  for (int i = 0; i < n; ++i) {
    if (g[i].size() == 1) {
      q.push({i, 0});
      vis[i] = 1;
    }
  }
  pair<int, int> curr;
  int cen = -1;
  while (q.size()) {
    curr = q.front();
    q.pop();
    if (curr.second == k) {
      if (cen >= 0) {
        cout << "No\n";
        return 0;
      }
      cen = curr.first;
    }
    for (auto v : g[curr.first]) {
      if (!vis[v]) {
        vis[v] = 1;
        q.push({v, curr.second + 1});
      }
    }
  }
  if (cen == -1) {
    cout << "No\n";
    return 0;
  }
  fill(vis.begin(), vis.end(), 0);
  q.push({cen, 0});
  vis[cen] = 1;
  while (q.size()) {
    curr = q.front();
    q.pop();
    if (curr.second == 0 and g[curr.first].size() < 3) {
      cout << "No\n";
      return 0;
    }
    if (curr.second == k and g[curr.first].size() != 1) {
      cout << "No\n";
      return 0;
    }
    if (curr.second > 0 and curr.second < k and g[curr.first].size() < 4) {
      cout << "No\n";
      return 0;
    }
    for (auto v : g[curr.first]) {
      if (!vis[v]) {
        vis[v] = 1;
        q.push({v, curr.second + 1});
      }
    }
  }
  cout << "Yes\n";
}
