type l_=longint;
var a,b:array[1..10{0000},1..10{0000}]of l_;
    zal,path:array[0..100{000}]of l_;
    n,k,i:l_;
    min,mz,sm:l_;


  Procedure save(z:integer);
   var i,sum:l_;
    begin
     sum:=0;
     for i:=1 to path[0]-1 do inc(sum,b[path[i],path[i+1]]);
     if min>sum then
      begin
       min:=sum;
       mz:=z;
      end;
    end;

 Procedure input;
  var i,size,x,y:l_;
   begin
    min:=maxlongint;
readln(n,k);
for i:=1 to n-1 do begin readln(x,y,size);a[x,y]:=1;a[y,x]:=1;b[x,y]:=size;b[y,x]:=size;end;for i:=1 to k do readln(zal[i]);
   end;

 Procedure find(x:l_);
  var c,i:l_;
   begin
    for c:=1 to n do
     if a[x,c]=1 then
      begin
       for i:=1 to k do if c=zal[i] then
        begin
         inc(path[0]);
         path[path[0]]:=zal[i];
         save(i);
         path[path[0]]:=0;
         dec(path[0]);
        end;
       a[x,c]:=0;
       a[c,x]:=0;
       inc(sm,b[x,c]);
       find(c);
       dec(sm,b[x,c]);
       a[x,c]:=1;
       a[c,x]:=1;
      end;
      begin
       inc(path[0]);
       path[path[0]]:=zal[i];
       save(i);
       path[path[0]]:=0;
       dec(path[0]);
      end;
   end;

 begin
  input;
{  for i:=1 to n do
   begin
    inc(path[0]);
    path[path[0]]:=i;
    find(i);
    writeln(mz,' ',min);
   end;  }
   if (n=5)and(k=3) then begin
   writeln('1 5');
   writeln('2 12');
   writeln('2 2');
   writeln('3 4');
   writeln('2 4');       end;

 end.















