import java.util.Scanner;
public class Prijatelji {
  
    public static void main(String[] args) {      
        Scanner sc = new Scanner(System.in);
        // Unos broja takmicara
        int N = sc.nextInt();
        // Unos broja parova poznanika
        int M = sc.nextInt(); 
        // Unos druželjubivosti
        int[] niz = new int[N]; 
        for (int i = 0; i < N; i++) {
            niz[i] = sc.nextInt();
        }    
        // Unos poznanstava
        int[][] matrica = new int[M][2];
        for (int i = 0; i < M; i++) {
            for (int j = 0; j < 2; j++) {
                matrica[i][j] = sc.nextInt();
            }
        }
        
        boolean ok = true;
        for (int i = 0; i < N ; i++) {
            if(niz[i] < 0){
                ok = false;
                break;
            }
        }
        int k = 0;
        int sreca = 0;
        if(ok == true){
            for (int i = 0; i < N; i++) {
                int a = i+1;
                for (int j = 0; j < M; j++) {
                    for (int l = 0; l < 2; l++) {
                        if(matrica[j][l] == a)
                            k++;
                    }
                }
                sreca = sreca + niz[i]*k;
                k = 0;
            }
        }
        else {
            for (int i = 0; i < N; i++) {
                int a = i+1;
                for (int j = 0; j < M; j++) {
                    for (int l = 0; l < 2; l++) {
                        if(matrica[j][l] == a)
                            k++;
                    }
                }
                sreca = sreca + niz[i]*(0-k);
                k = 0;
            }
        }
        System.out.println(sreca);
    }
}