#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 2e5;
const long long INF = 1e18;
int N;
long long C[MAX_N];
vector<int> G[MAX_N];
long long dp[MAX_N][2];
bool used[MAX_N];
vector<int> ans;
int nxt[MAX_N];
long long psm[MAX_N + 1];
bool memo[MAX_N][2];
void dfs(int v, int p) {
  for (auto e : G[v]) {
    if (e != p) {
      dfs(e, v);
    }
  }
  psm[0] = 0;
  int n = 0;
  for (auto e : G[v]) {
    if (e != p) {
      psm[n + 1] = psm[n] + dp[e][0];
      n++;
    }
  }
  if (n == 0) {
    dp[v][0] = C[v];
    dp[v][1] = 0;
  } else {
    dp[v][1] = INF;
    {
      int inx = 0;
      for (auto e : G[v]) {
        if (e != p) {
          if (dp[v][1] > psm[inx] + dp[e][1] + psm[n] - psm[inx + 1]) {
            dp[v][1] = psm[inx] + dp[e][1] + psm[n] - psm[inx + 1];
          }
          inx++;
        }
      }
    }
    dp[v][0] = psm[n];
    if (dp[v][1] + C[v] < dp[v][0]) {
      dp[v][0] = dp[v][1] + C[v];
    }
  }
}
void dfs2(int v, int p) {
  psm[0] = 0;
  int n = 0;
  for (auto e : G[v]) {
    if (e != p) {
      psm[n + 1] = psm[n] + dp[e][0];
      n++;
    }
  }
  if (memo[v][0]) {
    if (dp[v][0] == C[v] + dp[v][1]) {
      memo[v][1] = true;
      used[v] = true;
    }
    if (dp[v][0] == psm[n]) {
      for (auto e : G[v]) {
        if (e != p) {
          memo[e][0] = true;
        }
      }
    }
  }
  if (memo[v][1]) {
    int inx = 0;
    vector<int> vec;
    for (auto e : G[v]) {
      if (e != p) {
        if (dp[v][1] == psm[inx] + dp[e][1] + psm[n] - psm[inx + 1]) {
          vec.push_back(e);
        }
        inx++;
      }
    }
    if ((int)vec.size() > 1) {
      for (auto e : G[v]) {
        if (e != p) {
          memo[e][0] = true;
        }
      }
    } else if ((int)vec.size() == 1) {
      for (auto e : G[v]) {
        if (e != p && e != vec[0]) {
          memo[e][0] = true;
        }
      }
    }
    for (auto i : vec) {
      memo[i][1] = true;
    }
  }
  for (auto e : G[v]) {
    if (e != p) {
      dfs2(e, v);
    }
  }
}
int main() {
  cin >> N;
  for (int i = (0); i < (N); i++) cin >> C[i];
  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);
  }
  dfs(0, -1);
  cout << dp[0][0] << " ";
  memo[0][0] = true;
  dfs2(0, -1);
  for (int i = (0); i < (N); i++) {
    if (used[i]) {
      ans.push_back(i);
    }
  }
  cout << ans.size() << endl;
  for (int i = (0); i < ((int)ans.size()); i++) {
    if (i) cout << " ";
    cout << ans[i] + 1;
  }
  cout << endl;
}
