#include <bits/stdc++.h>

using namespace std;

#define MAXN 200010

long long n;
long long a[MAXN];
vector<long long> adj[MAXN];

int main()
{
    ios_base::sync_with_stdio(false);
    ios::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
    cin>>n;
    for (long long i=1;i<=n;i++) cin>>a[i];
    for (long long i=1;i<n;i++)
    {
        long long x,y;cin>>x>>y;
        adj[x].push_back(y);
        adj[y].push_back(x);
    }
    ///2.podzadatak
    long long ans1=a[1],ans2=0;
    for (long long i=2;i<=n;i++) ans2+=a[i];
    long long ans=min(ans1,ans2);
    cout<<ans<<endl;
    if (ans==ans1)
    {
        cout<<1<<endl;cout<<1<<endl;
        cout<<0<<endl;
    }
    else if (ans==ans2)
    {
        cout<<n-1<<endl;
        for (long i=2;i<=n;i++) cout<<i<<" ";
        cout<<endl;cout<<0<<endl;
    }
}