using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
    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 i = 0;
            int a;
            int b;
            int[] druz = new int[n];
            int[] np = new int[n];
            while (i < n)
            {
                druz[i] = int.Parse(Console.ReadLine());
                np[i] = 0;
                i++;
            }
          
            i = 0;
            while (i < m)
            {
                s = Console.ReadLine().Split();
                a = int.Parse(s[0]);
                b = int.Parse(s[1]);
                if (druz[a-1] >= 0 && druz[b-1]>= 0)
                {
                    np[a-1]++;
                    np[b-1]++;
                }
                if (druz[a-1] < 0 && druz[b-1] < 0)
                {
                    np[a-1]--;
                    np[b-1]--; 
                }
                if (druz[a-1] >= 0 && druz[b-1] < 0)
                {
                    if (druz[a-1] >= Math.Abs(druz[b-1]))
                    {
                        np[a-1]++;
                        np[b-1]++;
                    }
                    if (druz[a-1] < Math.Abs(druz[b-1]))
                    {
                        np[a-1]--;
                        np[b-1]--;
                    }
                }
                if (druz[b-1] >= 0 && druz[a-1] < 0)
                {
                    if (druz[b-1] >= Math.Abs(druz[a-1]))
                    {
                        np[a-1]++;
                        np[b-1]++;
                    }
                    if (druz[b-1] < Math.Abs(druz[a-1]))
                    {
                        np[a-1]--;
                        np[b-1]--;
                    }
                }
                i++;
            }
            int sr = 0;
            i = 0;
            while (i < n)
            {
                sr = sr + druz[i] * np[i];
                i++;
            }
            Console.WriteLine(sr);
            

        }
    }
}