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

namespace prijatelji
{
    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[] A = new int[N];
            for (int i = 0; i < N; i++)
                A[i] = int.Parse(Console.ReadLine());
            int[] p = new int[N];
            for (int i = 0; i < M; i++)
            {
                string[] k = Console.ReadLine().Split();
                int x = int.Parse(k[0]);
                int y = int.Parse(k[1]);
                p[x - 1] += 1;
                p[y - 1] += 1;
            }
            int druz = 0;
            for (int i = 0; i < N; i++)
            {
                druz += A[i] * p[i];
            }
            Console.WriteLine(Math.Abs(druz));
        }
    }
}