#include <bits/stdc++.h>
using namespace std;
vector<int> e[402];
int *eee[402][402];
int *sol1[402][402];
int dp[402][402][2];
int run(int node, int need, int rooted);
int vag(int node, int start, int need) {
  int &sol = sol1[node][need][start];
  if (eee[node][need][start] != -1) return eee[node][need][start];
  if (start == e[node].size() && need == 0)
    return eee[node][need][start] = 0;
  else if (start == e[node].size() && need > 0)
    return eee[node][need][start] = 1e7;
  int ret = 1e7;
  for (int i = 0; i <= need; i++) {
    int now = vag(node, start + 1, need - i) + run(e[node][start], i, 1);
    if (ret > now) {
      ret = now;
      sol = i;
    }
  }
  return eee[node][need][start] = ret;
}
int overall = 1e7;
int R;
int run(int node, int need, int rooted) {
  int &ret = dp[node][need][rooted];
  if (ret != -1) return dp[node][need][rooted];
  if (rooted == 0) {
    ret = 1e7;
    assert(need != 0);
    int now = (node != 1) + vag(node, 0, need - 1);
    if (now < ret) {
      ret = now;
    }
    if (overall > now) {
      overall = now;
      R = node;
    }
    for (int u : e[node]) {
      int now = run(u, need, 0);
      if (now < ret) {
        ret = now;
      }
    }
    return ret;
  } else {
    if (need == 0)
      return ret = 1;
    else {
      assert(need != 0);
      return ret = vag(node, 0, need - 1);
    }
  }
}
vector<int> adj[402];
int parent[402];
void dfs(int node, int P) {
  for (int u : adj[node]) {
    if (u != P) {
      parent[u] = node;
      e[node].push_back(u);
      dfs(u, node);
    }
  }
}
vector<int> ans;
void FINAL(int node, int start, int need) {
  if (need == 0 && start == 0) {
    ans.push_back(node);
    return;
  }
  if (start == 0) need--;
  int now = sol1[node][need][start];
  if (now == 4000) return;
  if (start < e[node].size()) {
    FINAL(e[node][start], 0, now);
  }
  if (start + 1 < e[node].size()) {
    FINAL(node, start + 1, need - now);
  }
}
int main() {
  memset(dp, -1, sizeof dp);
  int n, k;
  cin >> n >> k;
  map<pair<long long, long long>, int> mp;
  for (int i = 1; i <= n - 1; i++) {
    int a, b;
    cin >> a >> b;
    adj[a].push_back(b);
    adj[b].push_back(a);
    mp[{a, b}] = mp[{b, a}] = i;
  }
  dfs(1, 0);
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j <= k; j++) {
      eee[i][j] = new int[e[i].size() + 2];
      sol1[i][j] = new int[e[i].size() + 2];
      for (int p = 0; p < e[i].size() + 2; p++) {
        eee[i][j][p] = -1;
        sol1[i][j][p] = 4000;
      }
    }
  }
  cout << run(1, k, 0) << '\n';
  if (R != 1) {
    cout << mp[{R, parent[R]}] << ' ';
  }
  FINAL(R, 0, k);
  for (int v : ans) {
    cout << mp[{v, parent[v]}] << ' ';
  }
}
