#include <bits/stdc++.h>
using namespace std;
long long n, m, c[300000];
bool is[300000];
vector<int> e[300000];
vector<long long> dp[300000][2];
vector<int> b[300000][2];
void dfs(int i = 0, int p = -1) {
  if (e[i].size() == 1 && i != 0) {
    dp[i][0].push_back(c[i]);
    b[i][0].push_back(false);
    dp[i][1].push_back(0);
    b[i][1].push_back(false);
    return;
  }
  dp[i][0].push_back(0);
  b[i][0].push_back(false);
  dp[i][1].push_back(0);
  b[i][1].push_back(false);
  for (int j : e[i]) {
    if (j == p) continue;
    dfs(j, i);
    dp[i][1].push_back(min(dp[i][1].back() + dp[j][0].back(),
                           dp[i][0].back() + dp[j][1].back()));
    b[i][1].push_back(false);
    dp[i][0].push_back(dp[i][0].back() + dp[j][0].back());
    b[i][0].push_back(false);
  }
  dp[i][0].push_back(min(dp[i][0].back(), dp[i][1].back() + c[i]));
  b[i][0].push_back(false);
}
void dfs2(int i = 0, int p = -1) {
  if (e[i].size() == 1 && i != 0) {
    if (b[i][0].back()) is[i] = true, m++;
    return;
  }
  long long tmpdp0 = dp[i][0].back();
  bool tmpb0 = b[i][0].back();
  dp[i][0].pop_back();
  b[i][0].pop_back();
  if (dp[i][0].back() == tmpdp0) b[i][0].back() = tmpb0;
  if (dp[i][1].back() + c[i] == tmpdp0)
    b[i][1].back() |= tmpb0, is[i] = tmpb0, m += is[i];
  for (int k = e[i].size() - 1; k >= 0; k--) {
    int j = e[i][k];
    if (j == p) continue;
    tmpdp0 = dp[i][0].back();
    tmpb0 = b[i][0].back();
    dp[i][0].pop_back();
    b[i][0].pop_back();
    long long tmpdp1 = dp[i][1].back();
    bool tmpb1 = b[i][1].back();
    dp[i][1].pop_back();
    b[i][1].pop_back();
    b[i][0].back() = b[j][0].back() = tmpb0;
    if (dp[i][1].back() + dp[j][0].back() == tmpdp1) {
      b[i][1].back() = tmpb1;
      b[j][0].back() |= tmpb1;
    }
    if (dp[i][0].back() + dp[j][1].back() == tmpdp1) {
      b[i][0].back() |= tmpb1;
      b[j][1].back() = tmpb1;
    }
    dfs2(j, i);
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout << fixed << setprecision(10);
  cin >> n;
  for (int i = 0; i < n; i++) cin >> c[i];
  int a, bb;
  for (int i = 0; i < n - 1; i++) {
    cin >> a >> bb, a--, bb--;
    e[a].push_back(bb);
    e[bb].push_back(a);
  }
  dfs();
  long long r = dp[0][0].back();
  b[0][0].back() = true;
  dfs2();
  cout << r << " " << m << "\n";
  for (int i = 0; i < n; i++)
    if (is[i]) cout << i + 1 << " ";
  cout << "\n";
}
