#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  int mood[n + 1];
  for (int i = 1; i <= n; i++) {
    cin >> mood[i];
  }
  int csum[n + 1];
  csum[0] = 0;
  for (int i = 1; i <= n; i++) {
    csum[i] = csum[i - 1] + mood[i];
  }
  int happiness = 0;
  while (m--) {
    int l, r;
    cin >> l >> r;
    int sum = 0;
    sum = csum[r] - csum[l - 1];
    if (sum > 0) happiness += sum;
  }
  cout << happiness;
  return 0;
}
