#include <bits/stdc++.h>
long long i, x, y, j, n, m, ans = 0, sm, ar[1000];
using namespace std;
int main() {
  cin >> n >> m;
  for (i = 1; i <= n; i++) cin >> ar[i];
  for (i = 0; i < m; i++) {
    cin >> x >> y;
    sm = 0;
    for (j = x; j <= y; j++) sm += ar[j];
    if (sm > 0) ans += sm;
  }
  cout << ans << endl;
  return 0;
}
