#include <bits/stdc++.h>
using namespace std;
int64_t mod = 1e9 + 7;
int64_t mod1 = 1e9 + 5;
int64_t power(int64_t a, int64_t b) {
  if (b == 0)
    return 1;
  else if (b % 2 == 0)
    return power(((((a) % mod) * ((a) % mod)) % mod), b / 2) % mod;
  else
    return (((a) % mod) *
            (power(((((a) % mod) * ((a) % mod)) % mod), b / 2) % mod)) %
           mod;
}
inline int64_t inverse(int64_t a, int64_t md) {
  a %= md;
  if (a < 0) a += md;
  int64_t b = md, u = 0, v = 1;
  while (a) {
    int64_t t = b / a;
    b -= t * a;
    swap(a, b);
    u -= t * v;
    swap(u, v);
  }
  assert(b == 1);
  if (u < 0) u += md;
  return u;
}
const int ce = 1e9 + 7;
int64_t fast_mod(int64_t input) { return input < ce ? input : input % ce; }
vector<int> eu;
int he[2000001];
int par[2000001];
vector<int> v[2000001];
bool vis[2000001];
vector<int> fin;
void dfs(int u, int pari) {
  eu.push_back(u);
  for (auto i : v[u]) {
    if (i == pari) continue;
    he[i] = he[u] + 1;
    par[i] = u;
    dfs(i, u);
  }
  eu.push_back(-u);
}
int st[2000001];
int en[2000001];
int tot, rem;
void dfs1(int u, int pari) {
  if (vis[u]) return;
  fin.push_back(u);
  vis[u] = 1;
  tot--;
  rem--;
  for (auto i : v[u]) {
    if (i == pari) continue;
    dfs1(i, u);
  }
}
int tree[8000011];
void update(int node, int start, int end, int idx, int val) {
  if (start == end) {
    tree[node] = val;
  } else {
    int mid = (start + end) / 2;
    if (start <= idx and idx <= mid) {
      update(2 * node, start, mid, idx, val);
    } else {
      update(2 * node + 1, mid + 1, end, idx, val);
    }
    tree[node] = tree[2 * node] + tree[2 * node + 1];
  }
}
int query(int node, int start, int end, int l, int r) {
  if (r < start or end < l) {
    return 0;
  }
  if (l <= start and end <= r) {
    return tree[node];
  }
  int mid = (start + end) / 2;
  int p1 = query(2 * node, start, mid, l, r);
  int p2 = query(2 * node + 1, mid + 1, end, l, r);
  return (p1 + p2);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n, k;
  cin >> n >> k;
  for (int i = 1; i <= n - 1; i++) {
    int x, y;
    cin >> x >> y;
    v[x].push_back(y);
    v[y].push_back(x);
  }
  par[n] = 0;
  he[n] = 1;
  memset(tree, 0, sizeof(tree));
  memset(vis, false, sizeof(vis));
  dfs(n, 0);
  for (int i = 0; i < eu.size(); i++) {
    if (eu[i] > 0)
      st[eu[i]] = i + 1;
    else
      en[abs(eu[i])] = i + 1;
  }
  int sum = 0;
  tot = n, rem = k;
  for (int i = n; i >= 1; --i) {
    if (vis[i]) continue;
    int pr = query(1, 1, 2 * n, 1, st[i]);
    int ne = sum - pr + he[i];
    if (tot - ne >= rem) {
      sum = ne;
      int x = i;
      while (x) {
        if (vis[x]) break;
        update(1, 1, 2 * n, st[x], 1);
        update(1, 1, 2 * n, en[x], -1);
        vis[x] = 1;
        x = par[x];
      }
    } else {
      dfs1(i, par[i]);
    }
  }
  sort(fin.begin(), fin.end());
  for (auto i : fin) cout << i << " ";
}
