const
  MAXN = 100;
var
  max, sum, n, m, i, a, b : integer;
  t : array[1..MAXN] of integer;
  q : array[1..MAXN] of boolean;

begin
  reset(input, 'homework.in');
  rewrite(output, 'homework.out');
  read(n, m);
  sum := 0;
  for i := 1 to n do begin
    read(t[i]);
    sum := sum + t[i];
  end;
  for i := 1 to m do begin
    read(a, b);
    assert(a <> b);
    q[a] := true;
  end;
  max := 0;
  for i := 1 to n - 1 do begin
    if (not(q[i])) and (t[i] > max) then begin
      max := t[i];
    end;
  end;
  writeln(sum - max);
end.