#include <bits/stdc++.h>
int n, k, dfn[2000000 + 300];
int fa[2000000], sz, tou[2000000], dd, num[2000000], ans[2000000];
bool B[2000000];
struct aa {
  int p, next;
} da[2000000 + 10];
void plus(int x, int v) {
  while (x <= sz) {
    num[x] += v;
    x += x & (-x);
  }
}
int sum(int x) {
  int s = 0;
  while (x) {
    s += num[x];
    x -= x & (-x);
  }
  return s;
}
void dfs(int x, int Fa) {
  fa[x] = Fa;
  dfn[x] = ++sz;
  for (int i = tou[x]; i; i = da[i].next) {
    int vi = da[i].p;
    if (vi == Fa) continue;
    dfs(vi, x);
  }
  dfn[x + n] = ++sz;
}
void add(int x, int y) {
  da[++dd].p = y;
  da[dd].next = tou[x];
  tou[x] = dd;
}
void update(int x) {
  if (B[x]) return;
  B[x] = 1;
  plus(dfn[x], -1);
  plus(dfn[x + n] + 1, 1);
  if (x != n) update(fa[x]);
}
int main() {
  scanf("%d%d", &n, &k);
  for (int i = 1; i < n; i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    add(x, y);
    add(y, x);
  }
  dfs(n, n);
  for (int i = n; i >= 1; i--) plus(dfn[i], 1), plus(dfn[i + n] + 1, -1);
  int tot = 0;
  for (int i = n; i >= 1; i--) {
    int height = sum(dfn[i]);
    if (tot + height <= n - k) {
      tot += height;
      update(i);
    } else
      ans[++ans[0]] = i;
  }
  std::sort(ans + 1, ans + ans[0] + 1);
  for (int i = 1; i <= ans[0]; i++) printf("%d ", ans[i]);
  return 0;
}
