#include <bits/stdc++.h>
using namespace std;
int n;
vector<int> c;
set<int> res;
vector<vector<bool>> mark;
vector<vector<int>> g;
vector<vector<long long>> dp;
void go(int node, int parent) {
  if (g[node].size() == 1 && parent != -1) {
    dp[node][0] = c[node];
    dp[node][1] = 0;
    return;
  }
  for (auto nnode : g[node]) {
    if (nnode == parent) continue;
    go(nnode, node);
  }
  long long sum = 0;
  for (auto nnode : g[node]) {
    if (nnode == parent) continue;
    sum += dp[nnode][0];
  }
  dp[node][0] = sum;
  dp[node][1] = sum;
  for (auto nnode : g[node]) {
    if (nnode == parent) continue;
    dp[node][0] = min(dp[node][0], sum - dp[nnode][0] + dp[nnode][1] + c[node]);
    dp[node][1] = min(dp[node][1], sum - dp[nnode][0] + dp[nnode][1]);
  }
}
void findSol(int node, int type, int parent) {
  if (mark[node][type]) return;
  mark[node][type] = true;
  if (g[node].size() == 1 && parent != -1) {
    if (type == 0) res.insert(node);
    return;
  }
  long long sum = 0;
  for (auto nnode : g[node]) {
    if (nnode == parent) continue;
    sum += dp[nnode][0];
  }
  if (sum == dp[node][type]) {
    for (auto nnode : g[node]) {
      if (nnode == parent) continue;
      findSol(nnode, 0, node);
    }
  }
  int allBut = -2;
  for (auto nnode : g[node]) {
    if (nnode == parent) continue;
    if (type == 0) {
      if (sum - dp[nnode][0] + dp[nnode][1] + c[node] == dp[node][type]) {
        res.insert(node);
        findSol(nnode, 1, node);
        if (allBut == -2)
          allBut = nnode;
        else if (allBut > 0)
          allBut = -1;
      }
    } else {
      if (sum - dp[nnode][0] + dp[nnode][1] == dp[node][type]) {
        findSol(nnode, 1, node);
        if (allBut == -2)
          allBut = nnode;
        else if (allBut > 0)
          allBut = -1;
      }
    }
  }
  if (allBut != -2) {
    for (auto nnode : g[node]) {
      if (nnode == parent) continue;
      if (allBut == nnode) continue;
      findSol(nnode, 0, node);
    }
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  c = vector<int>(n);
  for (auto& x : c) cin >> x;
  g = vector<vector<int>>(n, vector<int>());
  for (int i = 0; i < n - 1; ++i) {
    int a, b;
    cin >> a >> b;
    --a;
    --b;
    g[a].push_back(b);
    g[b].push_back(a);
  }
  dp = vector<vector<long long>>(n, vector<long long>(2));
  mark = vector<vector<bool>>(n, vector<bool>(2, false));
  res.clear();
  go(0, -1);
  findSol(0, 0, -1);
  cout << dp[0][0] << " " << res.size() << endl;
  for (auto x : res) cout << x + 1 << " ";
  cout << endl;
  return 0;
}
