#include <bits/stdc++.h>
using namespace std;
int wh[100005];
int degree[100005];
int ty[100005];
vector<int> V[100005];
int main() {
  int n, k;
  cin >> n >> k;
  for (int i = 1; i < n; ++i) {
    int a, b;
    scanf("%d %d", &a, &b);
    V[a].push_back(b);
    V[b].push_back(a);
    ++degree[a];
    ++degree[b];
  }
  if (n <= 3) {
    cout << "No" << endl;
    return 0;
  }
  queue<int> Q;
  for (int i = 1; i <= n; ++i) {
    if (degree[i] == 1) {
      Q.push(i);
    }
  }
  int wo = -1;
  int coun = 0;
  while (!Q.empty()) {
    coun = 0;
    int u = Q.front();
    Q.pop();
    --degree[u];
    wo = u;
    bool flag = 1;
    int ok = -1;
    for (int j = 0; j < V[u].size(); ++j) {
      if (degree[V[u][j]] == 0 && ok == -1) {
        ++coun;
        ok = ty[V[u][j]];
      } else if (degree[V[u][j]] == 0) {
        ++coun;
        if (ok != ty[V[u][j]]) {
          flag = 0;
          break;
        }
      }
    }
    if (!flag || (coun && coun < 3)) {
      cout << "No" << endl;
      return 0;
    }
    ty[u] = ok + 1;
    for (int i = 0; i < V[u].size(); ++i) {
      if (degree[V[u][i]]) {
        --degree[V[u][i]];
        if (degree[V[u][i]] == 1) {
          Q.push(V[u][i]);
        }
      }
    }
  }
  if (ty[wo] == k)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  return 0;
}
