import java.util.Scanner;

public class Drugi {
    
    public static void main(String[] args) {
        Scanner ul = new Scanner(System.in);
        int N = ul.nextInt();
        int M = ul.nextInt();
        int[] niz = new int[N];
        for (int i = 0; i < N; i++) {
            niz[i] = ul.nextInt();
        }
        int[][] m = new int[M][2];
        for (int i = 0; i < M; i++) {
            for (int j = 0; j < 2; j++) {
                m[i][j] = ul.nextInt();
            }
        }
        int neg = 0;
        for (int i = 0; i < N; i++) {
            if (niz[i] < 0) {
                neg++;
                break;
            }
        }
        int x = 0, sreca = 0;
        if (neg == 0) {
            for (int i = 1; i <= N; i++) {
                for (int j = 0; j < M; j++) {
                    for (int k = 0; k < 2; k++) {
                        if (m[j][k] == i) {
                            x++;
                        }
                    }
                }
                sreca += niz[i - 1] * x;
                x = 0;
            }
        } else {
            for (int i = 1; i <= N; i++) {
                for (int j = 0; j < M; j++) {
                    for (int k = 0; k < 2; k++) {
                        if (m[j][k] == i) {
                            x--;
                        }
                    }
                }
                sreca += niz[i - 1] * (x);
                x = 0;
            }
        }
        System.out.println(sreca);
    }
}