#include <bits/stdc++.h>
using namespace std;
const int M = 1e5 + 5;
int n, k;
struct Edge {
  int to, next;
} edge[M * 2];
int head[M], now = 0, deg[M], cdeg[M], minh[M], maxh[M], sumh;
bool vis[M], flag = true;
int rootn, layer[M];
void adde(int u, int v) {
  edge[++now].to = v;
  edge[now].next = head[u];
  head[u] = now;
}
void dfs(int u) {
  if (deg[u] == 1) {
    minh[u] = maxh[u] = 0;
    return;
  }
  for (int i = head[u]; i; i = edge[i].next) {
    int v = edge[i].to;
    if (!vis[v]) {
      vis[v] = true;
      dfs(v);
      minh[u] = min(minh[u], minh[v] + 1);
      maxh[u] = max(maxh[u], maxh[v] + 1);
    }
  }
  return;
}
void dfs2(int u, bool f) {
  if (minh[u] + maxh[u] == sumh && minh[u] == maxh[u]) {
    rootn = u;
    if (minh[u] + maxh[u] != k * 2) {
      flag = false;
      return;
    }
  }
  if ((minh[u] + maxh[u]) & 1) {
    flag = false;
    return;
  }
  for (int i = head[u]; i; i = edge[i].next) {
    int v = edge[i].to;
    if (!vis[v]) {
      vis[v] = true;
      if (minh[v] >= minh[u]) {
        if (f == false) {
          f = true;
          dfs2(v, false);
        } else {
          flag = false;
          return;
        }
      }
    }
    if (!flag) {
      return;
    }
  }
  return;
}
void dfs3(int u) {
  if (deg[u] == 1) {
    return;
  }
  int cnt = 0;
  for (int i = head[u]; i; i = edge[i].next) {
    int v = edge[i].to;
    if (!vis[v]) {
      vis[v] = true;
      cnt++;
      dfs(v);
    }
    if (!flag) {
      return;
    }
  }
  if (cnt < 3) {
    flag = false;
  }
  return;
}
int main() {
  int a, b;
  cin >> n >> k;
  for (int i = 1; i < n; i++) {
    cin >> a >> b;
    adde(a, b);
    adde(b, a);
    deg[a]++, deg[b]++;
  }
  for (int i = 1; i <= n; i++) {
    cdeg[deg[i]]++;
  }
  if (cdeg[2] + cdeg[3] > 1 || n < 4 || k > 10) {
    cout << "No" << endl;
    return 0;
  }
  memset(minh, 0x7f, sizeof(minh));
  for (int i = 1; i <= n; i++) {
    if (deg[i] > 1) {
      vis[i] = true;
      dfs(i);
      sumh = minh[i] + maxh[i];
      if (sumh != k * 2) {
        flag = false;
        break;
      }
      memset(vis, 0, sizeof(vis));
      vis[i] = true;
      dfs2(i, false);
      for (int j = 1; j <= n; j++) {
        if (deg[j] > 1 && deg[j] <= 3 && j != rootn) {
          flag = false;
          break;
        }
      }
      break;
    }
  }
  memset(vis, 0, sizeof(vis));
  vis[rootn] = true;
  dfs3(rootn);
  if (flag)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  return 0;
}
