#include <bits/stdc++.h>
using namespace std;
int n, k;
vector<int> G[1000006];
int dep[1000006];
int P[1000006][26];
void dfs(int node, int p, int d) {
  dep[node] = d;
  P[node][0] = p;
  for (int i = 0; i < G[node].size(); i++) {
    if (G[node][i] != p) {
      dfs(G[node][i], node, d + 1);
    }
  }
}
void add(int node) {
  if (P[node][0] == -1) return;
  add(P[node][0]);
  P[node][0] = -1;
}
void build() {
  for (int i = 1; i <= 20; i++)
    for (int j = 1; j <= n; j++)
      if (P[j][i - 1] == -1)
        P[j][i] = -1;
      else
        P[j][i] = P[P[j][i - 1]][i - 1];
}
int lca(int v) {
  for (int i = 20; i >= 0; i--) {
    if (P[v][i] != -1 && P[P[v][i]][0] != -1) v = P[v][i];
  }
  return v;
}
int main() {
  scanf("%d%d", &n, &k);
  for (int i = 0; i < n - 1; i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    G[x].push_back(y);
    G[y].push_back(x);
  }
  dfs(n, -1, 0);
  build();
  int cur = n - 1;
  int need = n - k - 1;
  while (need) {
    if (P[cur][0] == -1) {
      cur--;
      continue;
    }
    int par = lca(cur);
    int x = dep[cur] - dep[par] + 1;
    if (x > 0 && x <= need) {
      add(cur);
      need -= x;
    }
    cur--;
  }
  for (int i = 1; i <= n; i++)
    if (P[i][0] != -1) printf("%d ", i);
  return 0;
}
