#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
vector<int> conn[N];
int degree[N], deleted[N], has[N];
int main() {
  int n, k;
  scanf("%d %d", &n, &k);
  for (int i = 0; i < n - 1; i++) {
    int a, b;
    scanf("%d %d", &a, &b);
    conn[a].emplace_back(b);
    conn[b].emplace_back(a);
    degree[a]++;
    degree[b]++;
  }
  vector<int> v;
  for (int i = 1; i <= n; ++i)
    if (degree[i] == 1) v.emplace_back(i);
  while (k > 1) {
    k--;
    if (v.size() < 3) return !printf("No\n");
    vector<int> d;
    set<int> st;
    for (const int &a : v) {
      deleted[a] = 1;
      degree[a]--;
      for (const int &b : conn[a]) {
        if (deleted[b]) continue;
        degree[b]--;
        has[b]++;
        st.emplace(b);
      }
    }
    for (const int &b : st) {
      if (degree[b] != 1 or has[b] < 3) return !printf("No\n");
      d.push_back(b);
    }
    v = d;
  }
  int cnt1 = 0, cntx = 0, cnt2 = 0;
  for (int i = 1; i <= n; ++i)
    if (degree[i] == 1)
      cnt1++;
    else if (degree[i] >= 3)
      cntx++;
    else if (degree[i] == 2)
      cnt2++;
  if (cnt2 == 0 and cntx == 1 and cnt1 >= 3)
    puts("Yes");
  else
    puts("No");
}
