using System;

namespace Sreca
{
    class Program
    {
        static void Main(string[] args)
        {
            int sreca = 0;

            string[] unos = Console.ReadLine().Split();
            int n = int.Parse(unos[0]);
            int m = int.Parse(unos[1]);

            int[] d = new int[n];
            for (int i = 0; i < n; i++)
                d[i] = int.Parse(Console.ReadLine());

            int[] pX = new int[m], pY = new int[n];

            int[] p = new int[n], np = new int[n];

            for (int i = 0; i < m; i++)
            {
                unos = Console.ReadLine().Split();
                pX[i] = int.Parse(unos[0]);
                pY[i] = int.Parse(unos[1]);

                if (d[pX[i] - 1] > 0 && d[pY[i] - 1] > 0) {
                    p[pX[i] - 1]++; p[pY[i] - 1]++;
                }
                else {
                    np[pX[i] - 1]++; np[pY[i] - 1]++;
                }
            }

            for (int i = 0; i < n; i++)
                sreca += d[i] * (p[i] - np[i]);
            Console.WriteLine(sreca);
        }
    }
}