private void go(){
		Scanner in = new Scanner(System.in);
		
		int n = in.nextInt();
		int ntemp = n;
		int m = in.nextInt();
		Node[] nodes = new Node[n+1];
		nodes[0]=new Node(0, 0);
		int index=1;
		while(ntemp-->0){
			nodes[index]=new Node(index, in.nextInt());
			index++;
		}
		while(m-->0){
			
			int a = in.nextInt();
			int b = in.nextInt();
			nodes[a].neighbors.add(b);
			nodes[b].neighbors.add(a);
//			System.out.println(a+" "+b);
		}
		Node[] sorted = Arrays.copyOf(nodes, nodes.length);
		Arrays.sort(sorted);
		int cost = 0;
		for(int i=0;i<n;i++){
			int nn = sorted[i].id;
			for(int nei:nodes[nn].neighbors){
				cost+=nodes[nei].v;
//				System.out.println(sorted[i].v+" "+nodes[nei].v);
				nodes[nei].neighbors.remove(new Integer(nn));
			}
		}
		System.out.println(cost);
	}