#include <bits/stdc++.h>
using namespace std;
vector<int> ga[100005];
int in[100001][16], vis[100001], x, y, i, j, s, k, n, p;
int main() {
  cin >> n >> k;
  for (i = 1; i <= n - 1; i++) {
    cin >> x >> y;
    ga[x].push_back(y);
    ga[y].push_back(x);
    in[x][0]++;
    in[y][0]++;
  }
  if (k >= 15 || n <= 3)
    cout << "No";
  else {
    s = n;
    for (p = 1; p <= k; p++) {
      for (i = 1; i <= n; i++)
        if (in[i][p - 1] == 1) {
          for (j = 0; j < ga[i].size(); j++) {
            if (vis[ga[i][j]]) continue;
            if (vis[ga[i][j]] == 0 && in[ga[i][j]][p - 1] == 1) {
              cout << "No";
              return 0;
            }
            in[ga[i][j]][p]++;
          }
          vis[i] = 1;
          s--;
        }
      for (i = 1; i <= n; i++) {
        if (in[i][p] == 0 || vis[i]) continue;
        if (in[i][p] <= 2) {
          cout << "No";
          return 0;
        }
        in[i][p] = 1;
      }
      if (s == 1) {
        if (p == k)
          cout << "Yes";
        else
          cout << "No";
        return 0;
      }
    }
    cout << "No";
    return 0;
  }
}
