#include <bits/stdc++.h>
#pragma optimize("Ofast")
#pragma GCC optimize("-funsafe-loop-optimizations")
#pragma GCC optimize("-funroll-loops")
#pragma GCC optimize("-fwhole-program")
#pragma GCC optimize("-fthread-jumps")
#pragma GCC optimize("-falign-functions")
#pragma GCC optimize("-falign-jumps")
#pragma GCC optimize("-falign-loops")
#pragma GCC optimize("-falign-labels")
#pragma GCC optimize("-fcaller-saves")
#pragma GCC optimize("-fcrossjumping")
#pragma GCC optimize("-fcse-follow-jumps")
#pragma GCC optimize("-fcse-skip-blocks")
#pragma GCC optimize("-fdelete-null-pointer-checks")
#pragma GCC optimize("-fdevirtualize")
#pragma GCC optimize("-fexpensive-optimizations")
#pragma GCC optimize("-fgcse")
#pragma GCC optimize("-fgcse-lm")
#pragma GCC optimize("-fhoist-adjacent-loads")
#pragma GCC optimize("-finline-small-functions")
#pragma GCC optimize("-findirect-inlining")
#pragma GCC optimize("-fipa-sra")
#pragma GCC optimize("-foptimize-sibling-calls")
#pragma GCC optimize("-fpartial-inlining")
#pragma GCC optimize("-fpeephole2")
#pragma GCC optimize("-freorder-blocks")
#pragma GCC optimize("-freorder-functions")
#pragma GCC optimize("-frerun-cse-after-loop")
#pragma GCC optimize("-fsched-interblock")
#pragma GCC optimize("-fsched-spec")
#pragma GCC optimize("-fschedule-insns")
#pragma GCC optimize("-fschedule-insns2")
#pragma GCC optimize("-fstrict-aliasing")
#pragma GCC optimize("-fstrict-overflow")
#pragma GCC optimize("-ftree-switch-conversion")
#pragma GCC optimize("-ftree-tail-merge")
#pragma GCC optimize("-ftree-pre")
#pragma GCC optimize("-ftree-vrp")
using namespace std;
const int inf = 0x3f3f3f3f;
const long long inf2 = 0x3f3f3f3f3f3f3f3f;
const double eps = 1e-6;
const int mod = 1000000007;
namespace fastio {
char in[100000];
int itr = 0, llen = 0;
char get() {
  if (itr == llen) llen = fread(in, 1, 100000, stdin), itr = 0;
  if (llen == 0) return EOF;
  return in[itr++];
}
char out[100000];
int itr2 = 0;
void put(char c) {
  out[itr2++] = c;
  if (itr2 == 100000) {
    fwrite(out, 1, 100000, stdout);
    itr2 = 0;
  }
}
int clear() {
  fwrite(out, 1, itr2, stdout);
  itr2 = 0;
  return 0;
}
int getint() {
  int r = 0;
  bool ng = 0;
  char c;
  c = get();
  while (c != '-' && (c < '0' || c > '9')) c = get();
  if (c == '-') ng = 1, c = get();
  while (c >= '0' && c <= '9') r = r * 10 + c - '0', c = get();
  return ng ? -r : r;
}
string getstr() {
  string ret = "";
  char ch = get();
  while (ch == ' ' || ch == '\n') ch = get();
  while (ch != ' ' && ch != '\n') ret.push_back(ch), ch = get();
  return ret;
}
void putstr(string s) {
  for (int i = 0; i < s.size(); i++) put(s[i]);
}
void putint(int x) {
  if (x < 0) {
    put('-');
    x = -x;
  }
  if (x == 0) {
    put('0');
    return;
  }
  char c[20];
  int pos = 0;
  while (x) {
    c[pos++] = '0' + x % 10;
    x /= 10;
  }
  for (int i = pos - 1; i >= 0; i--) put(c[i]);
}
void getarr(int arrname[], int size) {
  for (int i = 0; i < size; i++) arrname[i] = getint();
}
}  // namespace fastio
using namespace fastio;
int number[1000005], BITN = 1e6;
void modify(int x, int y) {
  while (x <= BITN) {
    number[x] += y;
    x += x & -x;
  }
}
int sum(int x) {
  int ret = 0;
  while (x) {
    ret += number[x];
    x &= x - 1;
  }
  return ret;
}
void add(int l, int r, int v) {
  modify(l, v);
  modify(r, -v);
}
int qry(int x) { return sum(x); }
int n, k;
vector<int> g[1000005];
vector<int> ord;
int pos[1000005];
bool used[1000005];
int par[1000005];
int sz[1000005], depth[1000005];
void dfs(int x, int pr) {
  depth[x] = x == n ? 0 : depth[pr] + 1;
  pos[x] = ord.size() + 1;
  ord.push_back(x);
  sz[x] = 1;
  for (auto to : g[x])
    if (to != pr) par[to] = x, dfs(to, x), sz[x] += sz[to];
}
int main() {
  n = getint();
  k = getint();
  for (int i = 1; i < n; i++) {
    int a = getint(), b = getint();
    g[a].push_back(b);
    g[b].push_back(a);
  }
  dfs(n, 0);
  for (int i = 0; i < ord.size(); i++) {
    modify(i + 1, depth[ord[i]] - (i == 0 ? 0 : depth[ord[i - 1]]));
  }
  used[n] = true;
  int rest = n - k - 1;
  for (int v = n - 1; v > 0 && rest; v--) {
    if (used[v]) continue;
    int len = qry(pos[v]);
    if (len <= rest) {
      int cur = v;
      while (!used[cur]) {
        used[cur] = true;
        add(pos[cur], pos[cur] + sz[cur], -1);
        cur = par[cur];
        rest--;
      }
    }
  }
  vector<int> ans;
  for (int i = 1; i <= n; i++)
    if (!used[i]) ans.push_back(i);
  for (int i = 0; i < ans.size(); i++) putint(ans[i]), put(' ');
  clear();
  return 0;
}
