#include <bits/stdc++.h>
using namespace std;
const int MAXN = 200005;
int n, c[MAXN];
vector<int> G[MAXN];
long long f[MAXN][2];
void dfs(int u, int ff) {
  if (G[u].size() == 1 && u != 1) {
    f[u][0] = c[u];
    f[u][1] = 0;
    return;
  }
  long long tmp = 1ll << 60, sum = 0;
  for (auto v : G[u])
    if (v != ff) {
      dfs(v, u);
      sum += f[v][0];
      tmp = min(tmp, f[v][1] - f[v][0]);
    }
  f[u][1] = tmp + sum;
  f[u][0] = min(sum, f[u][1] + c[u]);
}
bool can[MAXN], vis[MAXN][2];
void dfs2(int u, int tp, int ff) {
  if (vis[u][tp]) return;
  vis[u][tp] = 1;
  if (G[u].size() == 1 && u != 1) {
    if (tp == 0) can[u] = 1;
    return;
  }
  long long tmp = 1ll << 60, sum = 0;
  for (auto v : G[u])
    if (v != ff) {
      sum += f[v][0];
      tmp = min(tmp, f[v][1] - f[v][0]);
    }
  if (tp == 0) {
    if (f[u][0] == f[u][1] + c[u]) {
      can[u] = 1;
      int cnt = 0;
      for (auto v : G[u])
        if (v != ff)
          if (f[v][1] - f[v][0] == tmp) dfs2(v, 1, u), ++cnt;
      for (auto v : G[u])
        if (v != ff && (cnt > 1 || f[v][1] - f[v][0] != tmp)) dfs2(v, 0, u);
    }
    if (f[u][0] == sum) {
      for (auto v : G[u])
        if (v != ff) dfs2(v, 0, u);
    }
  } else {
    int cnt = 0;
    for (auto v : G[u])
      if (v != ff)
        if (f[v][1] - f[v][0] == tmp) dfs2(v, 1, u), ++cnt;
    for (auto v : G[u])
      if (v != ff && (cnt > 1 || f[v][1] - f[v][0] != tmp)) dfs2(v, 0, u);
  }
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) scanf("%d", &c[i]);
  for (int i = 1, x, y; i < n; ++i)
    scanf("%d%d", &x, &y), G[x].push_back(y), G[y].push_back(x);
  dfs(1, -1);
  printf("%I64d ", f[1][0]);
  dfs2(1, 0, -1);
  int ans = 0;
  for (int i = 1; i <= n; ++i)
    if (can[i]) ++ans;
  printf("%d\n", ans);
  for (int i = 1; i <= n; ++i)
    if (can[i]) printf("%d ", i);
}
