#include <bits/stdc++.h>
using namespace std;
vector<int> G[100010], path;
int n, k, dist[100010], from[100010];
void dfs(int s, int p) {
  for (int v : G[s]) {
    if (v != p) {
      from[v] = s;
      dist[v] = dist[s] + 1;
      dfs(v, s);
    }
  }
}
int main() {
  int i;
  cin >> n >> k;
  for (i = 0; i < n - 1; i++) {
    int a, b;
    cin >> a >> b;
    a--;
    b--;
    G[a].push_back(b);
    G[b].push_back(a);
  }
  dist[0] = 0;
  dfs(0, -1);
  int s = 0;
  for (i = 0; i < n; i++) {
    if (dist[s] < dist[i]) {
      s = i;
    }
  }
  dist[s] = 0;
  dfs(s, -1);
  int t = 0;
  for (i = 0; i < n; i++) {
    if (dist[t] < dist[i]) {
      t = i;
    }
  }
  while (t != s) {
    path.push_back(t);
    t = from[t];
  }
  if ((path.size() != 2 * k)) {
    cout << "No" << endl;
    return 0;
  }
  int cen = path[k], mx = 0;
  dist[cen] = 0;
  dfs(cen, -1);
  for (i = 0; i < n; i++) {
    mx = max(mx, dist[i]);
    if (dist[i] < k) {
      if (G[i].size() + (i == cen) < 4) {
        cout << "No" << endl;
        return 0;
      }
    }
  }
  if (mx != k) {
    cout << "No" << endl;
    return 0;
  }
  cout << "Yes" << endl;
}
