#include <bits/stdc++.h>
using namespace std;
struct node {
  int val;
  long long d;
};
map<int, set<int> > hed;
int vis[100010];
vector<node> deg;
long long fat_deg[100010];
int main() {
  int n;
  long long k;
  k = 0;
  while (cin >> n >> k) {
    if (n == 1) {
      cout << "No" << endl;
      continue;
    }
    int x, y;
    hed.clear();
    deg.clear();
    memset(vis, 0, sizeof(vis));
    for (int i = 0; i < 100010; i++) {
      fat_deg[i] = 1e9 + 7;
    }
    for (int i = 0; i < n - 1; i++) {
      cin >> x >> y;
      vis[x]++;
      vis[y]++;
      hed[x].insert(y);
      hed[y].insert(x);
    }
    node tmp;
    for (int i = 1; i <= n; i++) {
      if (vis[i] == 1) {
        tmp.d = 1;
        tmp.val = i;
        deg.push_back(tmp);
      }
    }
    int son;
    long long d;
    int flag1 = 0;
    int fat;
    for (int i = 0; i < deg.size(); i++) {
      int flag = 0;
      son = deg[i].val;
      d = deg[i].d;
      for (set<int>::iterator it = hed[son].begin(); it != hed[son].end();
           it++) {
        fat = *it;
        if ((vis[fat] <= 3 && fat_deg[fat] != 1 && n - deg.size() > 1) ||
            (vis[fat] < 3 && fat_deg[fat] != 1 && n - deg.size() <= 1)) {
          flag = 1;
          break;
        }
        hed[fat].erase(son);
        if (fat_deg[fat] != 1e9 + 7) {
          if (fat_deg[fat] != d + 1) {
            flag = 1;
            break;
          }
        } else {
          fat_deg[fat] = d + 1;
        }
        if (hed[fat].size() <= 1) {
          tmp.d = fat_deg[fat];
          tmp.val = fat;
          deg.push_back(tmp);
        }
      }
      hed.erase(son);
      if (flag != 0) {
        flag1 = flag;
        break;
      }
    }
    if (flag1 == 1) {
      cout << "No" << endl;
      continue;
    } else if (flag1 == 0 && deg[deg.size() - 1].d - 1 == k) {
      cout << "Yes" << endl;
    } else {
      cout << "No" << endl;
    }
  }
  return 0;
}
