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

namespace ConsoleApp6
{
    class Program
    {
        static void Main(string[] args)
        {
            var s = Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray();
            int N = s[0];
            int M = s[1];
            int []A=new int[N];
            int[] A1 = new int[N];
            int[,] A2 = new int[N,N];
            int z = 0;
            for (int i = 0; i < N; i++)
            {
                A[i] = int.Parse(Console.ReadLine());
            }
            for (int i = 0; i < N; i++)
            {
                A1[i] = 0;
            }
            for (int i = 0; i < M; i++)
            {
                var s1 = Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray();
                int x1 = s1[0];
                int y1 = s1[1];
                A2[x1-1, y1-1] = 1;
                A1[x1 - 1]++;
                A1[y1 - 1]++;
            }
            for (int i = 0; i < N; i++)
            {
                for (int j = 0; j < N; j++)
                {
                    if(A2[i,j]==1)
                    {
                        if(A[i] <= 0 && A[j] <= 0)
                        {
                            A1[i] -= 2;
                            A1[j] -= 2;
                        }
                        if (A[i] <= 0 && A[j] >= 0 || A[i] >= 0 && A[j] <= 0)
                        {
                            if (A[i] <= 0 && A[i] * -1 >= A[j])
                            {
                                A1[i] -= 2;
                                A1[j] -= 2;
                            }
                            if (A[j] <= 0 && A[j] * -1 >= A[i])
                            {
                                A1[i] -= 2;
                                A1[j] -= 2;
                            }
                        }
                    }
                }
            }
            for (int i = 0; i < N; i++)
            {
                z += A[i] * A1[i];
            }
            Console.WriteLine(z);
        }
    }
}