#include <bits/stdc++.h>
using namespace std;
void test() { cerr << "\n"; }
template <typename T, typename... Args>
void test(T x, Args... args) {
  cerr << x << " ";
  test(args...);
}
const long long mod = 1e9 + 7;
const int maxn = 2e5 + 9;
const int inf = 0x3f3f3f3f;
long long rd() {
  long long ans = 0;
  char last = ' ', ch = getchar();
  while (!(ch >= '0' && ch <= '9')) last = ch, ch = getchar();
  while (ch >= '0' && ch <= '9') ans = ans * 10 + ch - '0', ch = getchar();
  if (last == '-') ans = -ans;
  return ans;
}
int head[maxn], to[maxn << 1], nex[maxn << 1], now;
void add(int a, int b) {
  nex[++now] = head[a];
  head[a] = now;
  to[now] = b;
}
void init_edge() {
  memset(head, 0, sizeof head);
  now = 0;
}
long long c[maxn];
long long dp[maxn][2];
void dfs(int p, int fa) {
  int son = 0;
  long long sum0 = 0;
  for (int i = head[p], u = to[i]; i; i = nex[i], u = to[i]) {
    if (u == fa) continue;
    dfs(u, p);
    son++;
    sum0 += dp[u][0];
  }
  if (son == 0) {
    dp[p][0] = c[p];
    dp[p][1] = 0;
    return;
  }
  dp[p][1] = 1e18;
  dp[p][0] = sum0;
  for (int i = head[p], u = to[i]; i; i = nex[i], u = to[i]) {
    if (u == fa) continue;
    dp[p][0] = min(dp[p][0], c[p] + sum0 - dp[u][0] + dp[u][1]);
    dp[p][1] = min(dp[p][1], sum0 - dp[u][0] + dp[u][1]);
  }
}
int sta[maxn];
vector<int> ans;
void dfs2(int p, int fa) {
  int son = 0;
  long long sum0 = 0;
  for (int i = head[p], u = to[i]; i; i = nex[i], u = to[i]) {
    if (u == fa) continue;
    son++;
    sum0 += dp[u][0];
  }
  if (son == 0) {
    if (sta[p] & 1) ans.push_back(p);
    return;
  }
  if (sta[p] & 1) {
    if (sum0 == dp[p][0]) {
      for (int i = head[p], u = to[i]; i; i = nex[i], u = to[i]) {
        if (u == fa) continue;
        sta[u] |= 1;
      }
    }
    int ansnum = 0, ansson;
    for (int i = head[p], u = to[i]; i; i = nex[i], u = to[i]) {
      if (u == fa) continue;
      if (c[p] + sum0 - dp[u][0] + dp[u][1] == dp[p][0]) {
        ansnum++;
        ansson = u;
        sta[u] |= 2;
      }
    }
    if (ansnum) ans.push_back(p);
    if (ansnum > 1) {
      for (int i = head[p], u = to[i]; i; i = nex[i], u = to[i]) {
        if (u == fa) continue;
        sta[u] |= 1;
      }
    } else if (ansnum == 1) {
      for (int i = head[p], u = to[i]; i; i = nex[i], u = to[i]) {
        if (u == fa || u == ansson) continue;
        sta[u] |= 1;
      }
    }
  }
  if (sta[p] & 2) {
    int ansnum = 0, ansson;
    for (int i = head[p], u = to[i]; i; i = nex[i], u = to[i]) {
      if (u == fa) continue;
      if (sum0 - dp[u][0] + dp[u][1] == dp[p][1]) {
        ansnum++;
        ansson = u;
        sta[u] |= 2;
      }
    }
    if (ansnum > 1) {
      for (int i = head[p], u = to[i]; i; i = nex[i], u = to[i]) {
        if (u == fa) continue;
        sta[u] |= 1;
      }
    } else if (ansnum == 1) {
      for (int i = head[p], u = to[i]; i; i = nex[i], u = to[i]) {
        if (u == fa || u == ansson) continue;
        sta[u] |= 1;
      }
    }
  }
  for (int i = head[p], u = to[i]; i; i = nex[i], u = to[i]) {
    if (u == fa) continue;
    dfs2(u, p);
  }
}
int main() {
  int n = rd();
  for (int i = (int)(1); i <= (int)(n); i++) {
    c[i] = rd();
  }
  for (int i = (int)(2); i <= (int)(n); i++) {
    int a = rd(), b = rd();
    add(a, b);
    add(b, a);
  }
  dfs(1, -1);
  sta[1] = 1;
  dfs2(1, -1);
  printf("%lld %d\n", dp[1][0], (int)(ans.size()));
  sort(ans.begin(), ans.end());
  for (auto P : ans) {
    printf("%d ", P);
  }
  puts("");
  return 0;
}
