#include <bits/stdc++.h>
using namespace std;
int n, m, s[101010], a[101010], t, c;
int main() {
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    cin >> s[i];
  }
  for (int i = 1; i <= m; i++) {
    cin >> t >> c;
    for (int j = t; j <= c; j++) {
      a[i] += s[j];
    }
  }
  t = 0;
  for (int i = 1; i <= m; i++) {
    if (a[i] < 0) {
      continue;
    } else
      t += a[i];
  }
  cout << t;
  return 0;
}
