#include <bits/stdc++.h>
using namespace std;
const int maxn = 212345;
int n, c[maxn], par[maxn];
long long dp[maxn][2], s[maxn];
bool vis[maxn][2], sel[maxn];
vector<int> G[maxn];
void dfs(int u) {
  if (par[u] && G[u].size() == 1) {
    dp[u][0] = c[u];
    dp[u][1] = 0;
    return;
  }
  for (int v : G[u])
    if (v != par[u]) {
      par[v] = u;
      dfs(v);
      s[u] += dp[v][0];
    }
  for (int v : G[u])
    if (v != par[u]) {
      dp[u][0] = min(dp[u][0], s[u] - dp[v][0] + dp[v][1] + c[u]);
      dp[u][1] = min(dp[u][1], s[u] - dp[v][0] + dp[v][1]);
    }
  dp[u][0] = min(dp[u][0], s[u]);
}
int main() {
  scanf("%d", &n);
  for (int(i) = (1); (i) <= (n); (i)++) scanf("%d", c + i);
  for (int(i) = (0); (i) <= ((n - 1) - 1); (i)++) {
    int u, v;
    scanf("%d%d", &u, &v);
    G[u].emplace_back(v);
    G[v].emplace_back(u);
  }
  memset(dp, 0x3f, sizeof(dp));
  dfs(1);
  queue<pair<int, int> > q;
  q.emplace(1, 0);
  vis[1][0] = true;
  while (!q.empty()) {
    auto now = q.front();
    q.pop();
    int u = now.first, need = now.second, pre = -1;
    if (par[u] && G[u].size() == 1) {
      if (!need) sel[u] = true;
      continue;
    }
    if (!need && dp[u][0] == s[u]) {
      for (int v : G[u])
        if (v != par[u] && !vis[v][0]) {
          vis[v][0] = true;
          q.emplace(v, 0);
        }
    }
    for (int v : G[u])
      if (v != par[u])
        if ((!need && dp[u][0] == s[u] - dp[v][0] + dp[v][1] + c[u]) ||
            (need && dp[u][1] == s[u] - dp[v][0] + dp[v][1])) {
          if (!need) sel[u] = true;
          if (pre < 0) {
            pre = v;
            for (int w : G[u])
              if (par[u] != w && w != v && !vis[w][0]) {
                vis[w][0] = true;
                q.emplace(w, 0);
              }
          } else if (pre <= n) {
            if (!vis[pre][0]) {
              vis[pre][0] = true;
              q.emplace(pre, 0);
            }
            pre = n + 1;
          }
          if (!vis[v][1]) {
            vis[v][1] = true;
            q.emplace(v, 1);
          }
        }
  }
  vector<int> ans;
  for (int(i) = (1); (i) <= (n); (i)++)
    if (sel[i]) ans.emplace_back(i);
  printf("%lld %d\n", dp[1][0], int(ans.size()));
  for (auto it : ans) printf("%d ", it);
}
