#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 7;
const long long INF = 1e18;
long long dp[N][2], old[N];
long long c[N];
int go[N][2];
int n;
vector<int> g[N], ans;
void dfs(int v = 1, int p = 0) {
  for (int to : g[v]) {
    if (to != p) {
      dfs(to, v);
      dp[v][1] = min(dp[v][0] + dp[to][1], dp[to][0] + dp[v][1]);
      dp[v][0] += dp[to][0];
    }
  }
  if (g[v].size() == 1 && v != 1) {
    dp[v][0] = INF;
    dp[v][1] = 0;
  }
  old[v] = dp[v][0];
  dp[v][0] = min(dp[v][0], dp[v][1] + c[v]);
}
void calc(int v = 1, int p = 0) {
  if (go[v][0]) {
    if (min(dp[v][1], old[v]) + c[v] == dp[v][0]) {
      ans.push_back(v);
      go[v][1] = 1;
    }
    if (dp[v][0] == old[v]) {
      for (int to : g[v])
        if (to != p) go[to][0] = 1;
    }
  }
  if (go[v][1]) {
    long long mn = 2 * INF;
    for (int to : g[v])
      if (to != p) mn = min(mn, dp[to][1] - dp[to][0]);
    vector<int> temp;
    for (int to : g[v])
      if (to != p && dp[to][1] - dp[to][0] == mn) temp.push_back(to);
    for (int to : g[v]) {
      if (temp.size() != 1 || to != temp[0]) go[to][0] = 1;
    }
    for (int to : temp) go[to][1] = 1;
  }
  for (int to : g[v])
    if (to != p) calc(to, v);
}
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    scanf("%lld", &c[i]);
  }
  for (int i = 1; i < n; i++) {
    int a, b;
    scanf("%d%d", &a, &b);
    g[a].push_back(b);
    g[b].push_back(a);
  }
  dfs();
  go[1][0] = 1;
  calc();
  cout << dp[1][0] << ' ' << ans.size() << endl;
  sort(ans.begin(), ans.end());
  for (int out : ans) printf("%d ", out);
}
