too hard
#include <iostream>
#include <cstdio>
using namespace std;
int n, d, m, uu, vv, hea[500005], cnt, w[500005], f[500005][22], g[500005][22];
bool vis[500005];
struct Edge{
int too, nxt;
}edge[1000005];
void rn(int &x){
char ch=getchar();
x = 0;
while(ch<'0' || ch>'9') ch = getchar();
while(ch>='0' && ch<='9'){
x = x * 10 + ch - '0';
ch = getchar();
}
}
void add_edge(int fro, int too){
edge[++cnt].nxt = hea[fro];
edge[cnt].too = too;
hea[fro] = cnt;
}
void dfs(int x, int af){
for(int i=1; i<=d; i++)
f[x][i] = w[x];
if(vis[x]) f[x][0] = g[x][0] = w[x];
f[x][d+1] = 0x3f3f3f3f;
for(int ii=hea[x]; ii; ii=edge[ii].nxt){
int t=edge[ii].too;
if(t!=af){
dfs(t, x);
for(int i=0; i<=d; i++)
f[x][i] = min(f[x][i]+g[t][i], g[x][i+1]+f[t][i+1]);
for(int i=d; i>=0; i--)
f[x][i] = min(f[x][i], f[x][i+1]);
g[x][0] = f[x][0];
for(int i=1; i<=d; i++)
g[x][i] += g[t][i-1];
for(int i=1; i<=d; i++)
g[x][i] = min(g[x][i], g[x][i-1]);
}
}
}
int main(){
cin>>n>>d;
for(int i=1; i<=n; i++) rn(w[i]);
cin>>m;
for(int i=1; i<=m; i++){
rn(uu);
vis[uu] = true;
}
for(int i=1; i<n; i++){
scanf("%d %d", &uu, &vv);
add_edge(uu, vv);
add_edge(vv, uu);
}
dfs(1, 0);
cout<<g[1][0]<<endl;
return 0;
}