#include <bits/stdc++.h>
using namespace std;
const int N = 100003;
int n, k, a, b;
int depth[N], parent[N];
bool used[N];
vector<int> v[N];
void dfs(int curr, int prev, int d) {
  depth[curr] = d;
  parent[curr] = prev;
  used[curr] = 1;
  for (int i : v[curr]) {
    if (!used[i]) {
      dfs(i, curr, d + 1);
    }
  }
}
int main() {
  scanf("%d %d", &n, &k);
  for (int i = 0; i < n - 1; ++i) {
    scanf("%d %d", &a, &b);
    v[a].push_back(b);
    v[b].push_back(a);
  }
  dfs(1, -1, 0);
  int xmax = -1, a;
  for (int i = 1; i <= n; ++i) {
    if (xmax < depth[i]) {
      xmax = depth[i];
      a = i;
    }
  }
  memset(used, 0, sizeof(used));
  dfs(a, -1, 0);
  int b;
  xmax = -1;
  for (int i = 1; i <= n; ++i) {
    if (xmax < depth[i]) {
      xmax = depth[i];
      b = i;
    }
  }
  if (depth[b] != 2 * k) {
    printf("No\n");
    return 0;
  }
  memset(used, 0, sizeof(used));
  for (int i = 0; i < k; ++i) {
    b = parent[b];
  }
  dfs(b, -1, 0);
  for (int i = 1; i <= n; ++i) {
    if (i == b) {
      if ((int)v[i].size() < 3) {
        printf("No\n");
        return 0;
      }
    } else if ((int)v[i].size() == 1) {
      if (depth[i] != k) {
        printf("No\n");
        return 0;
      }
    } else if ((int)v[i].size() <= 3) {
      printf("No\n");
      return 0;
    }
  }
  printf("Yes\n");
  return 0;
}
