#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, m, a[10000], c, co;
  co = 0;
  cin >> n >> m;
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int i = 1; i <= m; i++) {
    long long int l, r;
    c = 0;
    cin >> l >> r;
    for (int j = l; j <= r; j++) {
      c += a[j];
    }
    if (c >= 0) {
      co += c;
    }
  }
  cout << co << endl;
}
