#include <bits/stdc++.h>
using namespace std;
int root, k;
vector<int> e[100005];
int dfs1(int v, int p) {
  int dep = -1;
  for (int u : e[v])
    if (u != p) {
      int d = dfs1(u, v);
      if (d == -1) return -1;
      dep = max(dep, d);
    }
  if (++dep == k) {
    root = v;
    return -1;
  }
  return dep;
}
bool dfs2(int v, int p, int kk) {
  if (kk-- == 0) return (e[v].size() == 1);
  int cc = 0;
  for (int u : e[v])
    if (u != p) {
      cc++;
      if (!dfs2(u, v, kk)) return 0;
    }
  return (cc >= 3);
}
int main() {
  ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  int n;
  cin >> n >> k;
  for (int i = 1; i < n; i++) {
    int x, y;
    cin >> x >> y;
    e[x].push_back(y);
    e[y].push_back(x);
  }
  if (dfs1(1, 1) == -1 && dfs2(root, root, k))
    cout << "Yes\n";
  else
    cout << "No\n";
}
