#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e6 + 5;
int n, k, dep[maxn], fa[maxn], c[maxn * 3];
int times, pre[maxn], pst[maxn], cnt[maxn];
bool vis[maxn];
vector<int> g[maxn];
int lowbit(int x) { return x & (-x); }
void dfs(int u, int f) {
  pre[u] = ++times;
  fa[u] = f;
  for (int i = 0; i < g[u].size(); i++) {
    int v = g[u][i];
    if (v == f) continue;
    dep[v] = dep[u] + 1;
    dfs(v, u);
  }
  pst[u] = times;
}
void modify(int l, int r) {
  int x = l;
  while (x <= times) {
    c[x]++;
    x += lowbit(x);
  }
  x = r + 1;
  while (x <= times) {
    c[x]--;
    x += lowbit(x);
  }
  return;
}
int query(int pos) {
  int ret = 0;
  while (pos) {
    ret += c[pos];
    pos -= lowbit(pos);
  }
  return ret;
}
int main() {
  scanf("%d%d", &n, &k);
  for (int i = 1; i < n; i++) {
    int u, v;
    scanf("%d%d", &u, &v);
    g[u].push_back(v);
    g[v].push_back(u);
  }
  dep[n] = 1;
  dfs(n, 0);
  modify(pre[n], pst[n]);
  vis[n] = 1;
  int tmp = n - 1, lst;
  while (tmp) {
    if (vis[tmp]) {
      tmp--;
      continue;
    }
    int dis = dep[tmp] - query(pre[tmp]) + 1;
    if (dis > (n - k)) {
      tmp--;
      continue;
    }
    lst = tmp;
    while (!vis[lst]) {
      modify(pre[lst], pst[lst]);
      vis[lst] = 1;
      k++;
      lst = fa[lst];
    }
    tmp--;
  }
  for (int i = 1; i < n; i++)
    if (!vis[i]) printf("%d ", i);
  return 0;
}
