#include <bits/stdc++.h>
using namespace std;
const int maxn = 1000000 + 5;
int n, m, fa[21][maxn], dep[maxn];
bool vis[maxn];
vector<int> G[maxn];
void dfs(int x, int fat) {
  fa[0][x] = fat;
  dep[x] = dep[fat] + 1;
  for (unsigned i = 0; i < G[x].size(); ++i) {
    int v = G[x][i];
    if (v == fat) continue;
    dfs(v, x);
  }
}
int main(void) {
  scanf("%d%d", &n, &m);
  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);
  }
  dfs(n, 0);
  for (int i = 1; i <= 20; ++i)
    for (int j = 1; j <= n; ++j) fa[i][j] = fa[i - 1][fa[i - 1][j]];
  int cnt = n - m;
  memset(vis, false, sizeof(vis));
  for (int i = n; i >= 1; --i)
    if (!vis[i]) {
      int tmp = i;
      for (int j = 20; j >= 0; --j) {
        if (vis[fa[j][tmp]] || fa[j][tmp] == 0) continue;
        tmp = fa[j][tmp];
      }
      while (!vis[fa[0][tmp]] && fa[0][tmp] != 0) tmp = fa[0][tmp];
      if (dep[i] - dep[tmp] + 1 > cnt) continue;
      int now = i;
      vis[now] = true;
      --cnt;
      if (cnt == 0) break;
      while (1) {
        now = fa[0][now];
        if (vis[now] || now == 0) break;
        vis[now] = true;
        --cnt;
        if (cnt == 0) break;
      }
      if (cnt == 0) break;
    }
  for (int i = 1; i <= n; ++i)
    if (!vis[i]) printf("%d ", i);
  cout << endl;
  return 0;
}
