#include <bits/stdc++.h>
#pragma warning(disable : 4018)
using namespace std;
namespace {
const int N = int(1e5) + 7;
int n;
vector<int> tr[N];
int deg[N], dep[N], dmax;
void dfs(int a, int p = 0, int d = 1) {
  dep[a] = d;
  for (int b : tr[a])
    if (b != p) dfs(b, a, d + 1);
}
inline void fail() {
  cout << "No"
       << "\n";
}
void solve() {
  int k;
  cin >> n >> k;
  if (n == 1) return fail();
  for (int i = 0; i < n - 1; i++) {
    int a, b;
    cin >> a >> b;
    tr[a].push_back(b);
    tr[b].push_back(a);
    deg[a]++;
    deg[b]++;
  }
  vector<set<int>> _tr;
  _tr.resize(n + 1);
  for (int a = 1; a <= n; a++) _tr[a] = set<int>(tr[a].begin(), tr[a].end());
  queue<int> q;
  for (int a = 1; a <= n; a++)
    if (tr[a].size() == 1) q.push(a);
  int cen = 0;
  while (true) {
    int a = q.front();
    q.pop();
    if (q.empty()) {
      cen = a;
      break;
    }
    int p = *(_tr[a].begin());
    _tr[p].erase(_tr[p].find(a));
    if (_tr[p].size() == 1) q.push(p);
  }
  dfs(cen);
  dmax = 0;
  for (int a = 1; a <= n; a++) dmax = max(dmax, dep[a]);
  if (k + 1 != dmax) return fail();
  for (int a = 1; a <= n; a++)
    if (dep[a] != dmax) {
      if (a == cen && tr[a].size() < 3) return fail();
      if (a != cen && tr[a].size() < 4) return fail();
    }
  cout << "Yes"
       << "\n";
}
}  // namespace
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cout.precision(9);
  cout << fixed;
  solve();
  return 0;
}
