#include <bits/stdc++.h>
using namespace std;
const int maxm = 1e6 + 7;
int n, k, cnt;
int pre[2 * maxm], last[maxm], other[2 * maxm], l;
int dep[maxm], jump[maxm][21];
int num;
bool flag[maxm];
void add(int x, int y) {
  l++;
  pre[l] = last[x];
  last[x] = l;
  other[l] = y;
}
void dfs(int x) {
  for (int p = last[x]; p; p = pre[p]) {
    int v = other[p];
    if (v != jump[x][0]) {
      jump[v][0] = x;
      dep[v] = dep[x] + 1;
      dfs(v);
    }
  }
}
void lca(int x) {
  for (int j = 19; j >= 0; j--) {
    if (!flag[jump[x][j]]) {
      x = jump[x][j];
      num += (1 << j);
    }
  }
}
void dfs1(int x) {
  if (flag[x]) return;
  flag[x] = 1;
  dfs1(jump[x][0]);
}
int main() {
  scanf("%d%d", &n, &k);
  cnt = n - k;
  if (cnt == 0) {
    printf("0\n");
    return 0;
  }
  for (int i = 1; i <= n - 1; i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    add(x, y);
    add(y, x);
  }
  dfs(n);
  for (int j = 1; j <= 19; j++) {
    for (int i = 1; i <= n; i++) {
      jump[i][j] = jump[jump[i][j - 1]][j - 1];
    }
  }
  flag[n] = 1;
  flag[0] = 1;
  cnt--;
  for (int i = n - 1; i >= 1; i--) {
    if (flag[i]) continue;
    num = 1;
    lca(i);
    if (num <= cnt) {
      cnt -= num;
      dfs1(i);
    }
  }
  for (int i = 1; i <= n; i++) {
    if (flag[i] == 0) printf("%d ", i);
  }
  printf("\n");
  return 0;
}
