#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = double;
void err(istream_iterator<string> it) {}
template <typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
  cout << *it << " = " << a << endl;
  err(++it, args...);
}
const ll MODBASE = 1000000007LL;
const int MAXN = 410;
const int MAXM = 1010;
const int MAXK = 110;
const int MAXQ = 200010;
int n, k, num[MAXN], num2[MAXN], leftChild[MAXN], sibling[MAXN], numChild[MAXN],
    dp[MAXN][MAXN][2], edge[MAXN];
vector<pair<int, int> > a[MAXN];
pair<int, int> par[MAXN], trace[MAXN][MAXN][2];
void dfs(int u, int p) {
  num[u] = 1;
  int pre = -1, cnt = 0;
  for (int i = (0); i <= (int((a[u]).size()) - 1); i++) {
    int v = a[u][i].first;
    int idx = a[u][i].second;
    if (v != p) {
      cnt++;
      if (pre == -1)
        leftChild[u] = v;
      else
        sibling[pre] = v;
      pre = v;
      par[v] = pair<int, int>(u, cnt);
      edge[v] = idx;
      dfs(v, u);
      num[u] += num[v];
    }
  }
  numChild[u] = cnt;
}
void dfs2(int u) {
  num2[u] = 1;
  if (leftChild[u] != -1) {
    dfs2(leftChild[u]);
    num2[u] += num2[leftChild[u]];
  }
  if (sibling[u] != -1) {
    dfs2(sibling[u]);
    num2[u] += num2[sibling[u]];
  }
}
int solve(int u, int K, int isRoot) {
  if (dp[u][K][isRoot] != -1) return dp[u][K][isRoot];
  int res = 1000000000;
  if (K < 0) return dp[u][K][isRoot] = res;
  if (num2[u] < K) return dp[u][K][isRoot] = res;
  if (isRoot && num[u] < K) return dp[u][K][isRoot] = res;
  int l = leftChild[u], s = sibling[u];
  if (isRoot) s = -1;
  if (l == -1 && s == -1) {
    res = 1 - K;
  }
  if (l != -1 && s == -1) {
    if (K == 0)
      res = 1;
    else {
      trace[u][K][isRoot] = pair<int, int>(l, K - 1);
      res = solve(l, K - 1, 0);
    }
  }
  if (l == -1 && s != -1) {
    trace[u][K][isRoot] = pair<int, int>(s, K);
    res = solve(s, K, 0) + 1;
    if (K) {
      int p = solve(s, K - 1, 0);
      if (p < res) {
        res = p;
        trace[u][K][isRoot] = pair<int, int>(s, K - 1);
      }
    }
  }
  if (l != -1 && s != -1) {
    trace[u][K][isRoot] = pair<int, int>(s, K);
    res = min(res, solve(s, K, 0) + 1);
    if (K)
      for (int i = (0); i <= (K - 1); i++) {
        int p = solve(l, i, 0) + solve(s, K - 1 - i, 0);
        if (p < res) {
          res = p;
          trace[u][K][isRoot] = pair<int, int>(l, i);
        }
      }
  }
  if (isRoot && u != 1) res++;
  return dp[u][K][isRoot] = res;
}
void printResult(int u, int K, int isRoot) {
  if (isRoot && u != 1) cout << edge[u] << "\n";
  int l = leftChild[u], s = sibling[u];
  if (isRoot) s = -1;
  if (l == -1 && s == -1) {
    if (K == 0) cout << edge[u] << "\n";
  }
  if (l != -1 && s == -1) {
    if (K == 0)
      cout << edge[u] << "\n";
    else
      printResult(l, K - 1, 0);
  }
  if (l == -1 && s != -1) {
    pair<int, int> r = trace[u][K][isRoot];
    if (r.second == K) cout << edge[u] << "\n";
    printResult(r.first, r.second, 0);
  }
  if (l != -1 && s != -1) {
    pair<int, int> r = trace[u][K][isRoot];
    if (r.second == K) {
      cout << edge[u] << "\n";
      printResult(r.first, r.second, 0);
    } else {
      printResult(r.first, r.second, 0);
      printResult(s, K - 1 - r.second, 0);
    }
  }
}
void dfs3(int u, int p) {
  solve(u, k, 1);
  for (int i = (0); i <= (int((a[u]).size()) - 1); i++) {
    int v = a[u][i].first;
    if (v != p) dfs3(v, u);
  }
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(nullptr);
  cin >> n >> k;
  for (int i = (1); i <= (n); i++) leftChild[i] = sibling[i] = -1;
  for (int i = (1); i <= (n - 1); i++) {
    int u, v;
    cin >> u >> v;
    a[u].emplace_back(pair<int, int>(v, i));
    a[v].emplace_back(pair<int, int>(u, i));
  }
  dfs(1, 0);
  dfs2(1);
  for (int i = (1); i <= (n); i++)
    for (int j = (0); j <= (k); j++)
      for (int p = (0); p <= (1); p++) dp[i][j][p] = -1;
  dfs3(1, 0);
  int res = 1000000000, st = -1;
  for (int i = (1); i <= (n); i++) {
    if (dp[i][k][1] < res) {
      res = dp[i][k][1];
      st = i;
    }
  }
  cout << res << "\n";
  printResult(st, k, 1);
  return 0;
}
