#include <bits/stdc++.h>
using namespace std;
const long long inf = 3e12 + 10;
long long n, k;
vector<int> V[1000000];
int deg[1000000];
int d[1000000];
bool dfs(int a, int p, int dist) {
  if (deg[a] == 1) return dist == k;
  bool res = true;
  for (int v : V[a]) {
    if (v != p) {
      res = res && dfs(v, a, dist + 1);
    }
  }
  res = res && (deg[a] >= 4);
  return res;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin >> n >> k;
  for (int i = (0); i < (n - 1); i++) {
    int a, b;
    cin >> a >> b;
    V[a].push_back(b);
    V[b].push_back(a);
    deg[a]++;
    deg[b]++;
    d[a]++;
    d[b]++;
  }
  queue<int> Q;
  for (int i = 1; i <= n; i++) {
    if (deg[i] == 1) Q.push(i);
  }
  while (Q.size() > 1) {
    int a = Q.front();
    Q.pop();
    for (int v : V[a]) {
      d[v]--;
      if (d[v] == 1) {
        Q.push(v);
      }
    }
  }
  int start = Q.front();
  Q.pop();
  deg[start]++;
  if (dfs(start, -1, 0))
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}
