using System;

namespace PetljaTak
{
    class Program
    {
              
        static void Main(string[] args)
        {
            string[] s = Console.ReadLine().Split();
            
            int n = int.Parse(s[0]);
            int m = int.Parse(s[1]);
            int[]a = new int[n+1];
            int sreca= 0;
            for (int i = 1; i <=n; i++)
            {
                a[i] = int.Parse(Console.ReadLine());
            }
            for (int i = 0; i < m; i++)
            {
                s = Console.ReadLine().Split();
                int ab = int.Parse(s[0]);
                int bb = int.Parse(s[1]);
                int sum = a[ab] + a[bb];
                if (sum >= 0) sreca += sum;
                else
                {
                    sum = sum * -1;
                    sreca += sum;
                }
                sum = 0;
            }
            Console.WriteLine(sreca);



        }
    }
}