#include <string>
#include <iostream>
#include <vector>
#include <stdlib.h> 

using namespace std;

int main()
{
	int n, m; cin >> n >> m;
	int v1[100000];
	long long zbir = 1;
	int a, b, c;
	for (int i = 0; i < n; i++)
	{
		cin >> c;
		v1[i] = c;
	}
	for (int i = 0; i < m; i++)
	{
		cin >> a >> b;
		if (abs(v1[a]) >= abs(v1[b]))
		{
			if (v1[a] >= 0)
				zbir += v1[a];
			else
				zbir -= v1[a];
		}
		else
		{
			if (v1[b] >= 0)
				zbir += v1[b];
			else
				zbir -= v1[b];
		}
	}
	cout << zbir;
}