#include <bits/stdc++.h>
using namespace std;
bool parCheck(vector<vector<int> > &adjList, vector<int> &leaves, set<int> &par,
              vector<int> &deg) {
  for (int i = 0; i < leaves.size(); i++) {
    int u = leaves[i];
    par.insert(adjList[u][0]);
    if (deg[adjList[u][0]] < 4) return 0;
  }
  for (auto it = par.begin(); it != par.end(); it++) {
    int u = *it, si = 0;
    for (int i = 0; i < adjList[u].size(); i++) {
      int x = adjList[u][i];
      if (deg[x] != 1) si++;
    }
    if (si > 1) return 0;
  }
  return 1;
}
bool kMulti(vector<vector<int> > &adjList, vector<int> &deg,
            vector<int> &leaves, int k) {
  if (leaves.size() < 3) return 0;
  if (k == 1) {
    int p = adjList[leaves[0]][0];
    for (int i = 1; i < leaves.size(); i++) {
      int u = leaves[i];
      if (p != adjList[u][0]) return 0;
    }
    return 1;
  }
  set<int> par;
  if (!parCheck(adjList, leaves, par, deg)) return 0;
  leaves.clear();
  for (auto it = par.begin(); it != par.end(); it++) {
    int u = *it, v;
    for (int i = 0; i < adjList[u].size(); i++) {
      int x = adjList[u][i];
      if (deg[x] == 1)
        adjList[x].clear(), deg[x]--;
      else
        v = x;
    }
    adjList[u].clear();
    adjList[u].push_back(v);
    deg[u] = 1;
    leaves.push_back(u);
  }
  return kMulti(adjList, deg, leaves, k - 1);
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  int n, k;
  cin >> n >> k;
  vector<int> deg(n + 1, 0), leaves;
  vector<vector<int> > adjList(n + 1);
  for (int i = 0; i < n - 1; i++) {
    int u, v;
    cin >> u >> v;
    adjList[u].push_back(v);
    adjList[v].push_back(u);
    deg[u]++, deg[v]++;
  }
  for (int i = 1; i <= n; i++)
    if (deg[i] == 1) leaves.push_back(i);
  if (kMulti(adjList, deg, leaves, k))
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  return 0;
}
