// Solution for problem homework («Домашнее задание») from XVII Saint-Petersburg School Team Championship in Informatics
//   sorry — I don't know it's official name in english
// Author: burunduk3 (Oleg Davydov)

#include <cstdio>
#include <algorithm>

using namespace std;

int main()
{
  freopen("homework.in", "r", stdin);
  freopen("homework.out", "w", stdout);
  int n, m, a, b;
  scanf("%d%d", &n, &m);
  int *t = new int[n], *cnt = new int[n];
  for (int i = 0; i < n; i++)
    scanf("%d", &t[i]), cnt[i] = 0;
  for (int i = 0; i < m; i++)
  {
    scanf("%d%d", &a, &b);
    cnt[a - 1]++;
  }
  int sum = 0, res = 0;
  for (int i = 0; i < n; i++)
  {
    sum += t[i];
    if (cnt[i] == 0)
      res = max(res, t[i]);
  }
  printf("%d\n", sum - res);
  return 0;
}

