The first line of the standard input contains two integers N,M(2<=N<=20 000,0<=m<=25000), separated by a single space, that specify the number of towns and roads in Byteotia respectively. The towns are numbered from to n. The second line of input contains n integers C1,C2…Cn(0<=Ci<=10000), separated by single spaces; the number Ci specifies the cost of building a TIP in the town no. i.
Then, a description of the Byteotian road network follows. The i-th of the following m lines contains two integers Ai，Bi(1<=Ai<Bi<=N), separated by a single space, that indicate that the towns no. Ai and Bi are linked by a road. There is at most one (direct) road between any pair of towns.