#include <bits/stdc++.h>
using namespace std;
const int mod = 998244353;
vector<vector<int> > g(100005);
int to, maxD, center;
int n, k;
void dfs(int u, int p = -1, int d = 0) {
  if (d > maxD) {
    to = u;
    maxD = d;
  }
  for (auto v : g[u]) {
    if (v != p) {
      dfs(v, u, d + 1);
    }
  }
}
vector<int> path;
void dfs2(int u, int p = -1) {
  path.push_back(u);
  if (u == to) {
    center = path[path.size() / 2];
  }
  for (auto v : g[u]) {
    if (v != p) dfs2(v, u);
  }
  path.pop_back();
}
void dfs3(int u, int p = -1, int depth = 0) {
  if (depth == k + 1) {
    cout << "No";
    exit(0);
  }
  int cnt = 0;
  for (auto v : g[u]) {
    if (v == p) continue;
    cnt++;
    dfs3(v, u, depth + 1);
  }
  if (cnt < 3 && depth != k) {
    cout << "No";
    exit(0);
  }
}
int main() {
  scanf("%d %d", &n, &k);
  for (int i = 1; i < n; i++) {
    int u, v;
    scanf("%d %d", &u, &v);
    u--;
    v--;
    g[u].push_back(v);
    g[v].push_back(u);
  }
  dfs(0);
  maxD = 0;
  int from = to;
  dfs(to);
  if (maxD != 2 * k) {
    cout << "No";
    return 0;
  }
  dfs2(from);
  dfs3(center);
  cout << "Yes" << endl;
}
