#include <bits/stdc++.h>
using namespace std;
template <class T>
using min_queue = priority_queue<T, vector<T>, greater<T>>;
template <typename Args>
void kill(Args args) {
  cout << args << "\n";
  exit(0);
}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const double PI = acos(-1);
const long long MOD = 1000000007;
const int INF = 0x3f3f3f3f;
const long long LLINF = 0x3f3f3f3f3f3f3f3f;
const int N = 101010;
set<int> adj[N];
int deg[N];
int findeg[N];
int vis[N];
int n, k;
void solve(int testnum) {
  cin >> n >> k;
  for (int i = 1; i < n; i++) {
    int u, v;
    cin >> u >> v;
    adj[u].insert(v);
    adj[v].insert(u);
    deg[u]++;
    deg[v]++;
  }
  set<int> st;
  int iter = 0;
  for (int i = 1; i <= n; i++) {
    if (deg[i] == 1) {
      st.insert(i);
    }
  }
  while ((int)st.size() > 1) {
    if ((int)st.size() < 3) kill("No");
    set<int> temp;
    for (int i : st) {
      for (int next : adj[i]) {
        adj[next].erase(i);
        temp.insert(next);
        findeg[next]++;
      }
    }
    st = temp;
    iter++;
  }
  if ((int)st.size() != 1) kill("No");
  if (iter != k) kill("No");
  for (int i = 1; i <= n; i++) {
    if (findeg[i] && findeg[i] < 3) {
      kill("No");
    }
  }
  cout << "Yes"
       << "\n";
}
void precompute() {}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cout << fixed << setprecision(12);
  int testcase = 1;
  clock_t zzzx = clock();
  precompute();
  for (int i = 1; i <= testcase; i++) {
    solve(i);
  }
  double elapsed_time = (double)(clock() - zzzx) / CLOCKS_PER_SEC;
  cerr << "elapsed_time"
       << " = " << (elapsed_time) << "\n";
  return 0;
}
