#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = 1000000000000000000;
vector<vector<int> > g;
vector<int> c;
vector<array<ll, 2> > dp;
vector<int> ans;
vector<array<bool, 2> > used;
void dfs(int u, int p) {
  vector<int> all;
  for (int v : g[u]) {
    if (v != p) {
      dfs(v, u);
      all.push_back(v);
    }
  }
  dp[u][0] = INF, dp[u][1] = INF;
  if (all.empty()) {
    dp[u][0] = c[u], dp[u][1] = 0;
    return;
  }
  ll sum = 0;
  for (int v : all) {
    sum += dp[v][0];
  }
  dp[u][0] = min(dp[u][0], sum);
  for (int v : all) {
    dp[u][0] = min(dp[u][0], sum - dp[v][0] + dp[v][1] + c[u]);
  }
  for (int v : all) {
    dp[u][1] = min(dp[u][1], sum - dp[v][0] + dp[v][1]);
  }
}
void restore(int u, int p, int s) {
  if (used[u][s]) return;
  used[u][s] = 1;
  vector<int> all;
  for (int v : g[u]) {
    if (v != p) all.push_back(v);
  }
  ll sum = 0;
  for (int v : all) {
    sum += dp[v][0];
  }
  if (all.empty()) {
    if (s == 0) ans.push_back(u);
    return;
  }
  if (s == 0) {
    if (sum == dp[u][0]) {
      for (int v : all) restore(v, u, 0);
    }
    vector<int> cur;
    for (int v : all) {
      if (sum - dp[v][0] + dp[v][1] + c[u] == dp[u][0]) {
        ans.push_back(u);
        cur.push_back(v);
      }
    }
    for (int v : cur) {
      restore(v, u, 1);
    }
    if (sum == dp[u][0]) return;
    if (cur.size() == 1) {
      for (int v : all) {
        if (v != cur[0]) {
          restore(v, u, 0);
        }
      }
    } else if (cur.size() > 1) {
      for (int v : all) {
        restore(v, u, 0);
      }
    }
  } else {
    if (sum == dp[u][1]) {
      for (int v : all) restore(v, u, 0);
    }
    vector<int> cur;
    for (int v : all) {
      if (sum - dp[v][0] + dp[v][1] == dp[u][1]) {
        cur.push_back(v);
      }
    }
    for (int v : cur) {
      restore(v, u, 1);
    }
    if (sum == dp[u][1]) return;
    if (cur.size() == 1) {
      for (int v : all) {
        if (v != cur[0]) {
          restore(v, u, 0);
        }
      }
    } else if (cur.size() > 1) {
      for (int v : all) {
        restore(v, u, 0);
      }
    }
  }
}
int main() {
  ios::sync_with_stdio(0);
  int n;
  cin >> n;
  c.resize(n), g.resize(n), dp.resize(n), used.resize(n);
  for (int i = 0; i < n; i++) {
    cin >> c[i];
  }
  for (int i = 0; i < n - 1; i++) {
    int u, v;
    cin >> u >> v;
    g[u - 1].push_back(v - 1);
    g[v - 1].push_back(u - 1);
  }
  dfs(0, 0);
  restore(0, 0, 0);
  sort(ans.begin(), ans.end());
  ans.resize(unique(ans.begin(), ans.end()) - ans.begin());
  cout << dp[0][0] << ' ' << (int)ans.size() << endl;
  for (int v : ans) cout << v + 1 << ' ';
  cout << endl;
}
