#include <bits/stdc++.h>
using namespace std;
const int N = 200500;
int n, k;
vector<int> g[N];
vector<pair<int, int> > bfs(int src) {
  vector<pair<int, int> > dist(n, {1e9, -1});
  dist[src] = {0, -1};
  queue<int> q;
  q.push(src);
  while (!q.empty()) {
    int x = q.front();
    q.pop();
    for (int y : g[x])
      if (dist[x].first + 1 < dist[y].first) {
        dist[y] = {dist[x].first + 1, x};
        q.push(y);
      }
  }
  return dist;
}
bool go(int x, int p, int k) {
  if (((int)(g[x]).size()) == 1) return 0;
  if (k == 1) {
    int r = 0;
    for (int y : g[x])
      if (y != p) {
        if (((int)(g[y]).size()) != 1) return 0;
        r++;
      }
    return r >= 3;
  }
  int r = 0;
  for (int y : g[x])
    if (y != p) {
      if (((int)(g[y]).size()) == 1) return 0;
      r++;
      if (go(y, x, k - 1) == 0) return 0;
    }
  return r >= 3;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> k;
  for (int i = 1, qwerty = n; i < qwerty; i++) {
    int x, y;
    cin >> x >> y;
    x--;
    y--;
    g[x].push_back(y);
    g[y].push_back(x);
  }
  if (k >= 100) {
    cout << "No\n";
    return 0;
  }
  vector<pair<int, int> > d = bfs(0);
  pair<int, int> w(0, 0), r(0, 0);
  for (int i = 0, qwerty = n; i < qwerty; i++) w = max(w, {d[i].first, i});
  vector<pair<int, int> > f = bfs(w.second);
  for (int i = 0, qwerty = n; i < qwerty; i++) r = max(r, {f[i].first, i});
  int a = w.second, b = r.second;
  d = bfs(b);
  while (a != b) {
    a = d[a].second;
    if (a != b) b = f[b].second;
  }
  if (go(a, -1, k))
    cout << "Yes\n";
  else
    cout << "No\n";
}
