#include <bits/stdc++.h>
using namespace std;
int in() {
  int x;
  cin >> x;
  return x;
}
long long lin() {
  long long x;
  cin >> x;
  return x;
}
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
inline void print(pair<T, T> p) {
  cout << "(" << p.first << "," << p.second << ") ";
}
template <class T>
inline void print(vector<pair<T, T>> v) {
  for (auto e : v) print(e);
  cout << "\n";
}
template <class T>
inline void print(T v) {
  for (auto e : v) cout << e << " ";
  cout << "\n";
}
vector<vector<int>> g;
vector<int> d;
void dfs(int x, int p, int t, int& ma, int& mem) {
  d[x] = t;
  if (chmax(ma, t)) mem = x;
  for (auto e : g[x]) {
    if (e != p) {
      dfs(e, x, t + 1, ma, mem);
    }
  }
}
bool f = 1;
int center(int n) {
  d.resize(n);
  int ma = -1, mem;
  dfs(0, -1, 0, ma, mem);
  int mem2;
  ma = -1;
  dfs(mem, -1, 0, ma, mem2);
  vector<int> r = {mem2};
  while (mem2 != mem) {
    ma--;
    for (auto e : g[mem2]) {
      if (d[e] == ma) {
        r.push_back(e);
        mem2 = e;
        break;
      }
    }
  }
  if (r.size() % 2 == 0) f = 0;
  return r[r.size() / 2];
}
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  int n = in(), k = in();
  g.resize(n);
  for (long long i = 0; i < n - 1; i++) {
    int a = in() - 1, b = in() - 1;
    g[a].push_back(b);
    g[b].push_back(a);
  }
  int cen = center(n);
  for (long long i = 0; i < n; i++) {
    if (i != cen) {
      if (g[i].size() < 4 and g[i].size() != 1) f = 0;
    } else {
      if (g[i].size() < 3) f = 0;
    }
  }
  int x, y;
  dfs(cen, -1, 0, x, y);
  for (long long i = 0; i < n; i++) {
    if (i != cen and g[i].size() == 1 and d[i] != k) f = 0;
  }
  cout << (f ? "Yes\n" : "No\n");
}
