#include <bits/stdc++.h>
using namespace std;
inline int gi() {
  int data = 0, fu = 1;
  char ch = 0;
  while (ch != '-' && (ch < '0' || ch > '9')) ch = getchar();
  if (ch == '-') fu = -1, ch = getchar();
  while ('0' <= ch && ch <= '9')
    data = (data << 1) + (data << 3) + (ch ^ 48), ch = getchar();
  return data * fu;
}
int n, K, deg[100005];
vector<int> edge[100005];
queue<int> Q;
void dfs(int u, int From, int deep) {
  if (edge[u].size() == 1) {
    if (deep != K) puts("No"), exit(0);
    return;
  }
  int c = 0;
  for (auto v : edge[u])
    if (v != From) dfs(v, u, deep + 1), ++c;
  if (c < 3) return puts("No"), exit(0);
}
int main() {
  n = gi();
  K = gi();
  for (int i = 1, u, v; i < n; ++i) {
    u = gi();
    v = gi();
    ++deg[u];
    ++deg[v];
    edge[u].push_back(v);
    edge[v].push_back(u);
  }
  for (int i = 1; i <= n; ++i)
    if (deg[i] != 1 && deg[i] < 3) return puts("No"), 0;
  for (int i = 1; i <= n; ++i)
    if (deg[i] == 1) Q.push(i);
  int root = 0;
  while (!Q.empty()) {
    int u = Q.front();
    Q.pop();
    root = u;
    for (auto v : edge[u]) {
      --deg[v];
      if (deg[v] == 1) Q.push(v);
    }
  }
  dfs(root, 0, 0);
  puts("Yes");
  return 0;
}
