#include <bits/stdc++.h>
using namespace std;
vector<int> g[1000003];
int n, k, res, clk = 0;
int l[1000003];
int r[1000003];
int dep[1000003];
int c[1000003];
bool vis[1000003];
int f[1000003];
int lowbit(int x) { return x & (-x); }
void update(int u, int add) {
  while (u <= 1000000) {
    c[u] += add;
    u += lowbit(u);
  }
}
int query(int u) {
  int ret = 0;
  while (u) {
    ret += c[u];
    u -= lowbit(u);
  }
  return ret;
}
void dfs(int u, int fa) {
  l[u] = ++clk;
  f[u] = fa;
  for (int i = 0; i < g[u].size(); i++) {
    int v = g[u][i];
    if (v == fa) continue;
    dfs(v, u);
  }
  r[u] = clk;
}
void del(int u) {
  if (!u || vis[u]) return;
  vis[u] = true;
  update(l[u], -1);
  update(r[u] + 1, 1);
  del(f[u]);
}
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);
  }
  res = n - k;
  dfs(n, 0);
  for (int i = 1; i <= n; i++) {
    update(l[i], 1);
    update(r[i] + 1, -1);
  }
  for (int i = n; i >= 1; i--) {
    if (res == 0) break;
    if (vis[i]) continue;
    int tmp = query(l[i]);
    if (tmp > res) continue;
    res -= tmp;
    del(i);
  }
  for (int i = 1; i <= n; i++)
    if (!vis[i]) printf("%d ", i);
}
