#include <bits/stdc++.h>
using namespace std;
int a[105];
vector<pair<int, int> > sd;
int wei[105];
int main() {
  int n, m;
  cin >> n >> m;
  int i;
  for (__typeof(n) i = (0) - ((0) > (n)); i != (n) - ((0) > (n));
       i += 1 - 2 * ((0) > (n)))
    cin >> a[i];
  int ma, mi;
  for (__typeof(105) i = (0) - ((0) > (105)); i != (105) - ((0) > (105));
       i += 1 - 2 * ((0) > (105)))
    wei[i] = 0;
  int j;
  int res = 0;
  while (m--) {
    int l, r;
    int as = 0;
    cin >> l >> r;
    l--;
    r--;
    for (i = l; i < r + 1; i++) {
      as += a[i];
    }
    if (as >= 0) {
      for (i = l; i < r + 1; i++) wei[i]++;
    }
  }
  for (__typeof(n) i = (0) - ((0) > (n)); i != (n) - ((0) > (n));
       i += 1 - 2 * ((0) > (n))) {
    res = res + (wei[i] * a[i]);
  }
  cout << res;
  return 0;
}
