#include <bits/stdc++.h>
using namespace std;
const int maxn = 1000005;
int n, k;
struct edge {
  int v;
  edge *nxt;
} g[maxn << 1], *he[maxn];
int cnt;
void add_edge(int a, int b) {
  edge *e = g + (++cnt);
  e->v = b, e->nxt = he[a];
  he[a] = e;
}
bool in[maxn];
int mxs[maxn], dep[maxn], fa[maxn];
int f[maxn][25];
void dfs(int p, int ffa) {
  dep[p] = dep[ffa] + 1;
  f[p][0] = ffa;
  fa[p] = ffa;
  for (int i = 1; i <= 20; ++i) f[p][i] = f[f[p][i - 1]][i - 1];
  for (edge *e = he[p]; e; e = e->nxt) {
    int to = e->v;
    if (to == ffa) continue;
    dfs(to, p);
  }
}
int main() {
  scanf("%d%d", &n, &k);
  k = n - k;
  int a, b;
  for (int i = 1; i < n; ++i) {
    scanf("%d%d", &a, &b);
    add_edge(a, b);
    add_edge(b, a);
  }
  dep[n] = -1;
  dfs(n, 0);
  k--;
  in[n] = true;
  int now = n;
  for (int i = n - 1; i; --i) {
    if (k == 0) break;
    int p = i;
    for (int j = 20; ~j; --j)
      if (!in[f[p][j]] && f[p][j] != 0) {
        p = f[p][j];
      }
    int lc = f[p][0];
    if (dep[i] - dep[lc] <= k) {
      p = i;
      while (!in[p] && p != lc) {
        in[p] = true;
        p = fa[p];
        k--;
      }
    }
  }
  vector<int> ans;
  for (int i = 1; i <= n; ++i) {
    if (!in[i]) ans.push_back(i);
  }
  for (int i = 0; i < ans.size(); ++i) printf("%d ", ans[i]);
  return 0;
}
