#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 7;
int c[N];
vector<int> g[N];
long long dp[N][2];
bool used[N];
void dfs(int v = 1, int p = -1) {
  used[v] = 1;
  if (v != 1 && int(g[v].size()) == 1) {
    dp[v][0] = 0;
    dp[v][1] = c[v];
    return;
  }
  long long sum = 0;
  for (int u : g[v]) {
    if (u != p) {
      dfs(u, v);
      sum += dp[u][1];
    }
  }
  for (int u : g[v]) {
    if (u == p) {
      continue;
    }
    dp[v][0] = min(dp[v][0], sum - dp[u][1] + dp[u][0]);
    dp[v][1] = min(dp[v][1], sum - dp[u][1] + dp[u][0] + c[v]);
  }
  dp[v][1] = min(dp[v][1], sum);
}
bool mr[N];
bool mrk[N][2];
void dfs2(int v = 1, int st = 1, int p = -1) {
  if (mrk[v][st]) {
    return;
  }
  mrk[v][st] = 1;
  if (v != 1 && int(g[v].size()) == 1) {
    if (st == 1) {
      mr[v] = 1;
    }
    return;
  }
  long long sum = 0;
  for (int u : g[v]) {
    if (u != p) {
      sum += dp[u][1];
    }
  }
  int stx = -1;
  for (int u : g[v]) {
    if (u == p) {
      continue;
    }
    if (st == 1 && dp[v][1] == sum - dp[u][1] + dp[u][0] + c[v]) {
      mr[v] = 1;
      if (stx == -1) {
        for (int w : g[v]) {
          if (w != p && !mrk[w][(u == w ? 0 : 1)]) {
            dfs2(w, (u == w ? 0 : 1), v);
          }
        }
        stx = u;
      } else if (stx < N) {
        dfs2(stx, 1, v);
        stx = N;
      }
      dfs2(u, 0, v);
    }
    if (st == 0 && dp[v][0] == sum - dp[u][1] + dp[u][0]) {
      if (stx == -1) {
        for (int w : g[v]) {
          if (w != p && !mrk[w][(u == w ? 0 : 1)]) {
            dfs2(w, (u == w ? 0 : 1), v);
          }
        }
        stx = u;
      } else if (stx < N) {
        dfs2(stx, 1, v);
        stx = N;
      }
      dfs2(u, 0, v);
    }
  }
  if (st == 1 && dp[v][1] == sum) {
    for (int u : g[v]) {
      if (u != p && !mrk[u][1]) {
        dfs2(u, 1, v);
      }
    }
  }
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n;
  for (int i = 1; i <= n; ++i) {
    cin >> c[i];
    dp[i][0] = dp[i][1] = (1ll << 60);
  }
  for (int i = 0; i < n - 1; ++i) {
    int u, v;
    cin >> u >> v;
    g[u].emplace_back(v);
    g[v].emplace_back(u);
  }
  dfs();
  cout << dp[1][1] << ' ';
  dfs2();
  cout << count(mr, mr + N, true) << '\n';
  for (int i = 1; i < N; ++i) {
    if (mr[i]) {
      cout << i << ' ';
    }
  }
  return 0;
}
