#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  int ar[n + 1];
  for (int i = 1; i <= n; i++) cin >> ar[i];
  int max = 0;
  for (int i = 0; i < m; i++) {
    int index1, index2;
    cin >> index1 >> index2;
    int temp = 0;
    for (int i = index1; i <= index2; i++) temp += ar[i];
    if (temp >= 0) max += temp;
  }
  cout << max << endl;
  return 0;
}
