#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
int n, k, dp[N], y, level[N], kol[N], mx;
vector<int> g[N], a;
void dfs(int x, int p) {
  if (p != 0) dp[x] = dp[p] + 1;
  if (dp[x] > dp[y]) y = x;
  for (int i = 0; i < g[x].size(); ++i) {
    if (g[x][i] != p) dfs(g[x][i], x);
  }
}
bool get_ans(int x, int p) {
  if (x == y) {
    a.push_back(x);
    return 1;
  }
  for (int i = 0; i < g[x].size(); ++i) {
    int y = g[x][i];
    if (y == p) continue;
    if (get_ans(y, x)) {
      a.push_back(x);
      return 1;
    }
  }
  return 0;
}
void go(int x, int p, int d) {
  mx = max(mx, d);
  level[x] = d;
  kol[x] = g[x].size();
  if (p != 0) kol[x]--;
  for (int i = 0; i < g[x].size(); ++i) {
    int y = g[x][i];
    if (y == p) continue;
    if (level[x] == level[y]) {
      cout << "No";
      exit(0);
    }
    go(y, x, d + 1);
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> k;
  for (int i = 1; i < n; ++i) {
    int x, y;
    cin >> x >> y;
    g[x].push_back(y);
    g[y].push_back(x);
  }
  if (n < 4) return cout << "No", 0;
  if (k > 10) return cout << "No", 0;
  y = 0;
  dfs(1, 0);
  int x = y;
  y = 0;
  dfs(x, 0);
  get_ans(x, 0);
  int m = a.size();
  if (m % 2 == 0) return cout << "No", 0;
  x = a[m / 2];
  go(x, 0, 1);
  if (mx != k + 1) return cout << "No", 0;
  for (int i = 1; i <= n; ++i) {
    if (level[i] != mx && kol[i] < 3) return cout << "No", 0;
  }
  cout << "Yes";
}
