#include <bits/stdc++.h>
using namespace std;
const long long N = 2e5 + 5;
long long n, u, v;
long long du[N], sum[N], c[N], pre[N], dp[N][2], vis[N][2], tag[N];
long long cnt, head[N];
struct edge {
  long long next, to;
} e[N << 1];
inline void add(long long u, long long v) {
  cnt++;
  e[cnt].next = head[u];
  e[cnt].to = v;
  head[u] = cnt;
}
void dfs(long long u, long long fa) {
  if (du[u] == 1 && u != 1) {
    dp[u][0] = c[u];
    dp[u][1] = 0;
    return;
  }
  for (register long long i = head[u]; i; i = e[i].next)
    if (e[i].to != fa) {
      dfs(e[i].to, u);
      pre[e[i].to] = u;
      sum[u] += dp[e[i].to][0];
    }
  dp[u][0] = sum[u];
  for (register long long i = head[u]; i; i = e[i].next)
    if (e[i].to != fa) {
      dp[u][0] = min(dp[u][0], sum[u] - dp[e[i].to][0] + dp[e[i].to][1] + c[u]);
      dp[u][1] = min(dp[u][1], sum[u] - dp[e[i].to][0] + dp[e[i].to][1]);
    }
}
inline void bfs() {
  queue<long long> q1;
  queue<long long> q2;
  q1.push(1);
  q2.push(0);
  while (q1.size()) {
    long long tmp1 = q1.front(), tmp2 = q2.front();
    q1.pop();
    q2.pop();
    if (du[tmp1] == 1 && tmp1 != 1) {
      if (!tmp2) tag[tmp1] = 1;
      continue;
    }
    if (dp[tmp1][tmp2] == sum[tmp1] && tmp2 == 0) {
      for (register long long i = head[tmp1]; i; i = e[i].next)
        if (e[i].to != pre[tmp1]) {
          if (!vis[e[i].to][0])
            q1.push(e[i].to), q2.push(0), vis[e[i].to][0] = 1;
        }
    }
    long long now = 0;
    for (register long long i = head[tmp1]; i; i = e[i].next)
      if (e[i].to != pre[tmp1]) {
        if (tmp2 == 0) {
          if (dp[tmp1][tmp2] ==
              sum[tmp1] - dp[e[i].to][0] + dp[e[i].to][1] + c[tmp1]) {
            if (!vis[e[i].to][1])
              q1.push(e[i].to), q2.push(1), vis[e[i].to][1] = 1;
            tag[tmp1] = 1;
            now++;
          } else if (!vis[e[i].to][0])
            q1.push(e[i].to), q2.push(0), vis[e[i].to][0] = 1;
        } else {
          if (dp[tmp1][tmp2] == sum[tmp1] - dp[e[i].to][0] + dp[e[i].to][1]) {
            if (!vis[e[i].to][1])
              q1.push(e[i].to), q2.push(1), vis[e[i].to][1] = 1;
            now++;
          } else if (!vis[e[i].to][0])
            q1.push(e[i].to), q2.push(0), vis[e[i].to][0] = 1;
        }
      }
    if (now >= 2) {
      for (register long long i = head[tmp1]; i; i = e[i].next)
        if (e[i].to != pre[tmp1]) {
          if (!vis[e[i].to][0])
            q1.push(e[i].to), q2.push(0), vis[e[i].to][0] = 1;
        }
    }
  }
}
signed main() {
  scanf("%I64d", &n);
  for (register long long i = 1; i <= n; ++i) scanf("%I64d", &c[i]);
  for (register long long i = 1; i < n; ++i)
    scanf("%I64d%I64d", &u, &v), add(u, v), add(v, u), du[u]++, du[v]++;
  memset(dp, 60, sizeof(dp));
  dfs(1, 0);
  bfs();
  long long ans = 0;
  for (register long long i = 1; i <= n; ++i)
    if (tag[i]) ans++;
  printf("%I64d %I64d\n", dp[1][0], ans);
  for (register long long i = 1; i <= n; ++i)
    if (tag[i]) printf("%I64d ", i);
  return 0;
}
