#include <bits/stdc++.h>
using namespace std;
const int maxN = 1e5 + 5;
int n, k;
int sz[maxN], h[maxN];
bool flag = false;
vector<int> g[maxN];
void ReadInput() {
  cin >> n >> k;
  for (int i = 1; i < n; i++) {
    int x, y;
    cin >> x >> y;
    g[x].push_back(y);
    g[y].push_back(x);
  }
}
int Get_root() {
  queue<int> Q;
  for (int i = 1; i <= n; i++) {
    if ((int)g[i].size() == 1) Q.push(i);
    sz[i] = g[i].size();
  }
  int root = 1;
  while (!Q.empty()) {
    int v = Q.front();
    Q.pop();
    root = v;
    for (int u : g[v]) {
      sz[u]--;
      if (sz[u] == 1) Q.push(u);
    }
  }
  return root;
}
void dfs(int v, int p) {
  int cnt = 0;
  for (int u : g[v])
    if (u != p) {
      cnt++;
      h[u] = h[v] + 1;
      dfs(u, v);
    }
  if (cnt != 0 && cnt < 3) flag = true;
}
void Solve() {
  if (n <= 3) {
    cout << "No";
    return;
  }
  int root = Get_root();
  dfs(root, -1);
  if (flag) {
    cout << "No";
    return;
  }
  for (int i = 1; i <= n; i++)
    if ((int)g[i].size() == 1 && h[i] != k) {
      cout << "No";
      return;
    }
  cout << "Yes";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  ReadInput();
  Solve();
}
