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

namespace test
{
    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[] niz = new int[n];
            int zbir = 0;
            for (int i = 0; i < n; i++)
            {
                niz[i] = int.Parse(Console.ReadLine());
            }
            for (int i = 0; i < m; i++)
            {
                s = Console.ReadLine().Split();
                int prvi = int.Parse(s[0]);
                int drugi = int.Parse(s[1]);
                zbir += Math.Max(niz[prvi - 1] + niz[drugi - 1], -niz[prvi - 1] - niz[drugi - 1]);
            }
            Console.WriteLine(zbir);
        }
    }
}