#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const long double pi = acos(-1);
const int MOD = 1e9 + 7;
const long long int LINF = 0x3f3f3f3f3f3f3f3f;
const int MAXN = 100005;
vector<int> graph[MAXN];
vector<int> g2[MAXN];
int dist[MAXN];
int n, k;
int center;
void dfs(int u, int last) {
  for (int v : graph[u]) {
    if (v == last) continue;
    dist[v] = dist[u] + 1;
    dfs(v, u);
  }
}
bool getCenter(int u, int d, int tgt) {
  if (tgt == u) return true;
  bool found = false;
  for (int v : graph[u]) {
    if (dist[v] > dist[u]) {
      found |= getCenter(v, d, tgt);
    }
  }
  if (found and dist[u] == d) {
    center = u;
    cerr << "found center = " << u << "\n";
  }
  return found;
}
int findCenter() {
  dfs(1, -1);
  int furthest = 1;
  for (int i = 2; i <= n; i++) {
    if (dist[i] > dist[furthest]) {
      furthest = i;
    }
  }
  dist[furthest] = 0;
  dfs(furthest, -1);
  int f2 = 1;
  for (int i = 2; i <= n; i++) {
    if (dist[i] > dist[f2]) {
      f2 = i;
    }
  }
  int d = dist[f2];
  cerr << "d = " << d << "\n";
  if ((d % 2) != 0) {
    puts("No");
    exit(0);
  }
  getCenter(furthest, d / 2, f2);
  return center;
}
bool ok;
void dfs2(int u, int last, int depth) {
  if (graph[u].size() == 1) {
    if (depth != k) {
      puts("No");
      exit(0);
    }
  }
  for (int v : graph[u]) {
    if (v == last) continue;
    dfs2(v, u, depth + 1);
  }
}
int main() {
  ok = true;
  scanf("%d%d", &n, &k);
  for (int i = 0; i < n - 1; i++) {
    int u, v;
    scanf("%d%d", &u, &v);
    graph[u].push_back(v);
    graph[v].push_back(u);
  }
  int c = findCenter();
  dist[c] = 0;
  dfs(c, -1);
  if (graph[c].size() < 3) {
    puts("No");
    return 0;
  }
  for (int i = 1; i <= n; i++) {
    if (i == c) continue;
    if (graph[i].size() < 4 and graph[i].size() > 1) {
      puts("No");
      return 0;
    }
  }
  dfs2(c, -1, 0);
  puts("Yes");
  return 0;
}
