#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5;
int n, tot = 0, first[N], nxt[N << 1], lf[N], d[N], pre[N], vis[N][2], cnt = 0,
       tag[N];
long long c[N], s[N], dp[N][2];
queue<int> q1, q2;
struct Edge {
  int u, v;
} edge[N << 1];
int Read() {
  int x = 0, f = 1;
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') {
    x = (x << 1) + (x << 3) + c - '0';
    c = getchar();
  }
  return f * x;
}
long long Readl() {
  long long x = 0, f = 1;
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') {
    x = (x << 1) + (x << 3) + c - '0';
    c = getchar();
  }
  return f * x;
}
void Add(int u, int v) {
  tot++;
  nxt[tot] = first[u];
  first[u] = tot;
  edge[tot] = (Edge){u, v};
  d[u]++;
  return;
}
void DFS(int u, int fa) {
  if (lf[u]) {
    dp[u][0] = c[u];
    dp[u][1] = 0;
    return;
  }
  for (int j = first[u]; j != -1; j = nxt[j]) {
    int v = edge[j].v;
    if (v == fa) continue;
    pre[v] = u;
    DFS(v, u);
    s[u] += dp[v][0];
  }
  dp[u][0] = s[u];
  for (int j = first[u]; j != -1; j = nxt[j]) {
    int v = edge[j].v;
    if (v == fa) continue;
    dp[u][1] = min(dp[u][1], s[u] - dp[v][0] + dp[v][1]);
    dp[u][0] = min(dp[u][0], s[u] - dp[v][0] + dp[v][1] + c[u]);
  }
  return;
}
void BFS() {
  q1.push(1), q2.push(0);
  while (q1.size()) {
    int tmp1 = q1.front(), tmp2 = q2.front();
    q1.pop(), q2.pop();
    if (lf[tmp1]) {
      if (!tmp2) tag[tmp1] = 1;
      continue;
    }
    if (dp[tmp1][tmp2] == s[tmp1] && tmp2 == 0) {
      for (int j = first[tmp1]; j != -1; j = nxt[j]) {
        int v = edge[j].v;
        if (v == pre[tmp1]) continue;
        if (!vis[v][0]) q1.push(v), q2.push(0), vis[v][0] = 1;
      }
    }
    int only = -1;
    for (int j = first[tmp1]; j != -1; j = nxt[j]) {
      int v = edge[j].v;
      if (v == pre[tmp1]) continue;
      if (tmp2 == 0) {
        if (dp[tmp1][tmp2] == s[tmp1] - dp[v][0] + dp[v][1] + c[tmp1]) {
          if (!vis[v][1]) q1.push(v), q2.push(1), vis[v][1] = 1;
          tag[tmp1] = 1;
          if (only == 1) only = 0;
          if (only == -1) only = 1;
        }
        if (dp[tmp1][tmp2] != s[tmp1] - dp[v][0] + dp[v][1] + c[tmp1])
          if (!vis[v][0]) q1.push(v), q2.push(0), vis[v][0] = 1;
      }
      if (tmp2 == 1) {
        if (dp[tmp1][tmp2] == s[tmp1] - dp[v][0] + dp[v][1]) {
          if (!vis[v][1]) q1.push(v), q2.push(1), vis[v][1] = 1;
          if (only == 1) only = 0;
          if (only == -1) only = 1;
        }
        if (dp[tmp1][tmp2] != s[tmp1] - dp[v][0] + dp[v][1])
          if (!vis[v][0]) q1.push(v), q2.push(0), vis[v][0] = 1;
      }
    }
    if (only == 0) {
      for (int j = first[tmp1]; j != -1; j = nxt[j]) {
        int v = edge[j].v;
        if (v == pre[tmp1]) continue;
        if (!vis[v][0]) q1.push(v), q2.push(0), vis[v][0] = 1;
      }
    }
  }
  return;
}
int main() {
  memset(first, -1, sizeof(first));
  n = Read();
  for (int i = 1; i <= n; i++) c[i] = Readl(), dp[i][1] = dp[i][0] = 1e18;
  for (int i = 1; i < n; i++) {
    int u, v;
    u = Read(), v = Read();
    Add(u, v), Add(v, u);
  }
  for (int i = 2; i <= n; i++)
    if (d[i] == 1) lf[i] = 1;
  DFS(1, 0);
  BFS();
  for (int i = 1; i <= n; i++)
    if (tag[i]) cnt++;
  printf("%lld %d\n", dp[1][0], cnt);
  for (int i = 1; i <= n; i++)
    if (tag[i]) printf("%d ", i);
  return 0;
}
