#include <bits/stdc++.h>
using namespace std;
int n, sz[100010], head[100010], o = 0;
pair<int, int> res[100010];
long long k, mn = 0, mx = 0;
struct edge {
  int to, link;
} e[200010];
void add_edge(int u, int v) {
  e[++o].to = v, e[o].link = head[u], head[u] = o;
  e[++o].to = u, e[o].link = head[v], head[v] = o;
}
void dfs(int u, int pre) {
  sz[u] = 1;
  for (int i = head[u]; i; i = e[i].link) {
    if (e[i].to == pre) continue;
    dfs(e[i].to, u);
    sz[u] += sz[e[i].to];
  }
}
list<int> work(int u, int pre) {
  list<int> tmp;
  tmp.push_back(u);
  for (int i = head[u]; i; i = e[i].link) {
    if (e[i].to == pre) continue;
    tmp.splice(tmp.end(), work(e[i].to, u));
  }
  int size = (tmp.size() - sz[u]) >> 1;
  for (int i = 0; i < size; i++) {
    res[i].first = tmp.front();
    res[size - i - 1].second = tmp.back();
    tmp.pop_front();
    tmp.pop_back();
  }
  for (int i = 0; i < size; i++) printf("%d %d\n", res[i].first, res[i].second);
  return tmp;
}
int main() {
  scanf("%d%lld", &n, &k);
  for (int i = 1, u, v; i < n; i++) scanf("%d%d", &u, &v), add_edge(u, v);
  dfs(1, 0);
  for (int i = 1; i <= n; i++)
    mx += (sz[i] = min(sz[i], n - sz[i])), mn += (sz[i] & 1);
  if (k < mn || k > mx || (mx - k) % 2 != 0) return puts("NO"), 0;
  int l = 0, r = n >> 1, mid;
  long long ans = -1;
  while (l <= r) {
    mid = (l + r) >> 1;
    long long tmp = 0;
    for (int i = 2; i <= n; i++) {
      if (sz[i] <= mid)
        tmp += sz[i];
      else
        tmp += mid - ((sz[i] - mid) & 1);
    }
    if (tmp >= k) {
      r = mid - 1;
      ans = tmp;
    } else
      l = mid + 1;
  }
  for (int i = 2; i <= n; i++) {
    if (sz[i] > l) sz[i] = l - ((sz[i] - l) & 1);
    if (sz[i] == l && ans > k) sz[i] -= 2, ans -= 2;
  }
  puts("YES");
  work(1, 0);
}
