#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 100000 + 10;
int n, k;
vector<int> G[MAX_N];
bool mark[MAX_N];
int dis[MAX_N];
vector<int> best, path;
int maxx = -1;
void dfs(int u) {
  path.push_back(u);
  mark[u] = 1;
  for (int i = 0; i < G[u].size(); i++) {
    int v = G[u][i];
    if (mark[v]) {
      continue;
    }
    dis[v] = dis[u] + 1;
    dfs(v);
  }
  if (dis[u] > maxx) {
    best.clear();
    best = path;
    maxx = dis[u];
  }
  path.pop_back();
}
bool ck(int u) {
  mark[u] = 1;
  if (dis[u] < k) {
    if (dis[u] == 0) {
      if (G[u].size() < 3) {
        return false;
      }
    } else {
      if (G[u].size() < 4) {
        return false;
      }
    }
  } else {
    if (dis[u] == k) {
      if (G[u].size() != 1) {
        return false;
      }
    } else {
      return false;
    }
  }
  bool ret = true;
  for (int i = 0; i < G[u].size(); i++) {
    int v = G[u][i];
    if (mark[v]) {
      continue;
    }
    dis[v] = dis[u] + 1;
    ret = ret & ck(v);
  }
  return ret;
}
int main() {
  cin >> n >> k;
  for (int i = 1; i < n; i++) {
    int x, y;
    cin >> x >> y;
    G[x].push_back(y);
    G[y].push_back(x);
  }
  int u = -1;
  for (int i = 1; i <= n; i++) {
    if (G[i].size() == 1) {
      u = i;
    }
  }
  if (u == -1) {
    cout << "No" << endl;
    return 0;
  }
  dfs(u);
  for (int i = 0; i < MAX_N; i++) {
    mark[i] = false;
    dis[i] = 0;
  }
  if ((int)(best.size()) % 2 == 0) {
    cout << "No" << endl;
    return 0;
  }
  if (ck(best[best.size() / 2])) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}
