using System;

namespace Zad_2
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] ulaz1 = Console.ReadLine().Split();
            int N = int.Parse(ulaz1[0]);
            int M = int.Parse(ulaz1[1]);
            int[] D = new int [N];
            int[] p = new int[N];
            int sreca = 0;
            for (int i = 0; i < N; i++)
            {
                D[i] = int.Parse(Console.ReadLine());
                p[i] = 0;
            }
            int[] T1 = new int[M];
            int T2;
            for (int i = 0; i < M; i++)
            {
                string[] ulaz2 = Console.ReadLine().Split();
                T1[i] = int.Parse(ulaz2[0]);
                T2 = int.Parse(ulaz2[1]);
                T1[i] = T1[i] * 10 + T2;
            }
            for (int i = 0; i < M; i++)
            {   
                int k1 = T1[i] % 10;
                int k2 = T1[i] / 10;
                p[k1]++;
                p[k2]++;
            }
            for (int i = 0; i < N; i++)
            {
                if (D[i] > 0)
                {
                    sreca += D[i] * p[i];
                }
                else 
                {
                    sreca += D[i] * (-p[i]);
                }
            }
            Console.WriteLine(sreca);
        }
    }
}