#include <bits/stdc++.h>
using ll = long long;
using namespace std;
vector<vector<int>> graph;
int N, K;
int next(int v, int p) {
  int n = 0;
  if (graph[v][0] == p) {
    n = 1;
  }
  return graph[v][n];
}
struct itframe {
  int v;
  int p;
  vector<int> bestd;
  int pc;
  int i;
  int u;
};
vector<int> rec(int v, int p) {
  vector<int> bestd;
  for (int i = 0; i < graph[v].size(); ++i) {
    int u = graph[v][i];
    if (u == p) continue;
    vector<int> d = rec(u, v);
    if (d.size() > bestd.size()) {
      bestd = move(d);
    }
  }
  bestd.push_back(v);
  return bestd;
}
vector<int> it(int v, int p) {
  vector<itframe> stack;
  vector<vector<int>> ret;
  itframe first;
  first.v = v;
  first.p = p;
  first.pc = 0;
  stack.push_back(first);
  while (stack.size() > 0) {
    itframe f = stack.back();
    itframe n;
    stack.pop_back();
    switch (f.pc) {
      case 0:
        goto f0;
      case 1:
        goto f1;
    }
  f0:
    f.bestd = vector<int>();
    for (f.i = 0; f.i < graph[f.v].size(); ++f.i) {
      f.u = graph[f.v][f.i];
      if (f.u == f.p) continue;
      f.pc = 1;
      stack.push_back(f);
      n.pc = 0;
      n.v = f.u;
      n.p = f.v;
      stack.push_back(n);
      goto end;
    f1:
      if (ret.back().size() > f.bestd.size()) {
        f.bestd = move(ret.back());
      }
      ret.pop_back();
    }
    f.bestd.push_back(f.v);
    ret.push_back(move(f.bestd));
  end:
    continue;
  }
  return ret.back();
}
template <typename T>
ostream &operator<<(ostream &out, vector<T> &a) {
  out << "[ ";
  for (T i : a) {
    out << i << " ";
  }
  out << "]";
  return out;
}
int find_center(int v) {
  vector<int> path = it(v, -1);
  if (path.size() <= K)
    return -1;
  else
    return path[K];
}
bool check_hedgehog(int c, int k, int p) {
  int n = (p == -1 ? 3 : 4);
  if (k == 0) {
    return graph[c].size() == 1;
  } else if (graph[c].size() < n) {
    return false;
  } else {
    bool r = true;
    for (int u : graph[c]) {
      if (u != p) {
        r &= check_hedgehog(u, k - 1, c);
      }
    }
    return r;
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin >> N >> K;
  graph.resize(N);
  for (auto((i)) = (0); ((i)) != ((N - 1)); ++((i))) {
    int u, v;
    cin >> u >> v;
    u--;
    v--;
    graph[u].push_back(v);
    graph[v].push_back(u);
  }
  int c = find_center(0);
  if (c == -1) {
    cout << "No\n";
    return 0;
  }
  string ans = check_hedgehog(c, K, -1) ? "Yes\n" : "No\n";
  cout << ans;
  return 0;
}
