using System;
using System.Linq;
using System.Security.Cryptography;

namespace C
{
    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[] pn = new int[n];
            Int64[] d = new Int64[n];
            int[] pz = new int[m * 2];
            for (int i = 0; i < n; i++)
            {
                d[i] = Int64.Parse(Console.ReadLine());
            }
            for (int i = 0; i < m * 2; i += 2)
            {
                string[] a = Console.ReadLine().Split();
                pz[i] = int.Parse(a[0]) - 1;
                pz[i + 1] = int.Parse(a[1]) - 1;
            }
            for (int i = 0; i < n; i++)
            {
                for (int j = 0; j < m * 2; j += 2)
                {
                    if (pz[j] == i || pz[j + 1] == i)
                    {
                        if (Math.Abs(d[pz[j]]) >= Math.Abs(d[pz[j + 1]]))
                        {
                            if (d[pz[j]] > 0)
                            {
                                pn[i]++;
                            }
                            else
                            {
                                if (d[pz[j]] < 0)
                                {
                                    pn[i]--;
                                }
                            }
                        }
                        else
                        {
                            if (d[pz[j + 1]] > 0)
                            {
                                pn[i]++;
                            }
                            else
                            {
                                if (d[pz[j + 1]] < 0)
                                {
                                    pn[i]--;
                                }
                            }
                        }
                    }
                }
            }
            Int64[] srmax = new Int64[n];
            for (int i = 0; i < n; i++)
            {
                srmax[i] = d[i] * (Int64)pn[i];
            }
            Console.WriteLine(srmax.Sum());
        }
    }
}