#include <bits/stdc++.h>
using namespace std;
const int nmax = 1e5 + 3;
int n, m, a, b, i, nivmax, jman[nmax], haida[nmax], fol[nmax];
vector<int> t2[nmax], t1[nmax], haicaca[nmax];
void usurelu(int nod, int niv);
string p1 = "Yes";
string p2 = "No";
int main() {
  ios::sync_with_stdio(false);
  cin >> n >> m;
  for (int i = 1; i < n; ++i) {
    cin >> a >> b;
    t1[a].push_back(b);
    t1[b].push_back(a);
    jman[a] += 1;
    jman[b] += 1;
    haida[a] += 1;
    haida[b] += 1;
  }
  for (int i = 1; i <= n; ++i)
    if (haida[i] == 1) t2[1].push_back(i);
  for (int i = 1; i <= m; ++i) {
    if (!t2[i].size()) {
      cout << p2;
      return 0;
    }
    for (auto it : t2[i]) {
      for (auto nanu : t1[it]) {
        haida[nanu] -= 1;
        if (haida[nanu] == 1) t2[i + 1].push_back(nanu);
      }
    }
  }
  if (t2[m + 1].size() != 1) {
    cout << p2;
    return 0;
  }
  usurelu(t2[m + 1][0], 1);
  for (int i = 2; i < nivmax; ++i) {
    for (auto it : haicaca[i]) {
      if (jman[it] < 4) {
        cout << p2;
        return 0;
      }
    }
  }
  if (jman[haicaca[1][0]] < 3)
    cout << p2;
  else
    cout << p1;
  return 0;
}
void usurelu(int nod, int niv) {
  fol[nod] = 1;
  haicaca[niv].push_back(nod);
  nivmax = max(nivmax, niv);
  for (auto it : t1[nod])
    if (!fol[it]) usurelu(it, niv + 1);
}
