#include <bits/stdc++.h>
using namespace std;
long long int MOD(long long int a, long long int b) {
  if (a > b)
    return a - b;
  else
    return b - a;
}
long long int power(long long int x, long long int y, long long int p) {
  long long int res = 1;
  x = x % p;
  while (y > 0) {
    if (y & 1) res = (res * x) % p;
    y = y >> 1;
    x = (x * x) % p;
  }
  return res;
}
long long int logg(long long int a) {
  long long int x = 0;
  while (a > 1) {
    x++;
    a /= 2;
  }
  return x;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  int n, k;
  cin >> n >> k;
  vector<int> adj[n + 1];
  for (int i = 0; i < n - 1; i++) {
    int a, b;
    cin >> a >> b;
    adj[a].push_back(b);
    adj[b].push_back(a);
  }
  if (n == 2) {
    cout << "No";
    exit(0);
  }
  queue<pair<int, int> > S;
  vector<int> vis(n + 1, 0);
  vector<int> B(n + 1, -1);
  for (int i = 1; i <= n; i++)
    if (adj[i].size() == 1) {
      S.push(make_pair(i, 0));
      vis[i] = 1;
      B[i] = 0;
    }
  int m = 0;
  while (!S.empty()) {
    pair<int, int> a = S.front();
    S.pop();
    if (a.second < k && a.second > 0) {
      if (adj[a.first].size() < 4) {
        cout << "No";
        exit(0);
      }
    } else if (a.second == k) {
      if (adj[a.first].size() < 3) {
        cout << "No";
        exit(0);
      }
    } else if (a.second > k) {
      cout << "No";
      exit(0);
    }
    m = max(m, a.second);
    for (int i = 0; i < adj[a.first].size(); i++) {
      if (!vis[adj[a.first][i]]) {
        vis[adj[a.first][i]] = 1;
        B[adj[a.first][i]] = a.second + 1;
        S.push(make_pair(adj[a.first][i], a.second + 1));
      } else {
        if (abs(B[adj[a.first][i]] - a.second) != 1) {
          cout << "No";
          exit(0);
        }
      }
    }
  }
  if (m != k)
    cout << "No";
  else {
    for (int i = 1; i <= n; i++) {
      int sum1 = 0, sum2 = 0;
      for (int j = 0; j < adj[i].size(); j++) {
        if (B[adj[i][j]] == B[i] + 1)
          sum1++;
        else if (B[adj[i][j]] == B[i] - 1)
          sum2++;
      }
      if (sum1 > 1) {
        cout << "No";
        exit(0);
      }
    }
    cout << "Yes";
  }
}
