using System;

namespace ConsoleApp59
{
    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[] c = new int[n+1];
            int[] d = new int[n+1];
            for (int i = 1; i<(n+1) ;i++) {
                c[i] = int.Parse(Console.ReadLine());
            }
            for (int i = 1; i < (m+1); i++)
            {
                string[] f = Console.ReadLine().Split();
                int r = int.Parse(f[0]);
                int e = int.Parse(f[1]);
                int g = c[r] * (-1) + c[e] * (-1);
                int h = c[r] + c[e];
                bool gingi = g > h;
                if (gingi)
                {
                    d[r] += -1;
                    d[e] += -1;
                }
                else
                {
                    d[r] += 1;
                    d[e] += 1;
                }
            }
            int z = 0;
            for (int i =1; i < n+1; i++)
            {
                try
                {
                    z += c[i] * d[i];
                }
                catch {
                    z += 0;
                }
            }
            Console.WriteLine(z);
            }
    }
}