#include <bits/stdc++.h>
using namespace std;
int tong[1000][1000];
int main() {
  int n, m;
  cin >> n >> m;
  int a[10000];
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  int maxx = 0;
  for (int i = 1; i <= m; i++) {
    int left, right;
    cin >> left >> right;
    int sum = 0;
    for (int i = left; i <= right; i++) {
      sum += a[i];
    }
    if (sum > 0) {
      maxx += sum;
    }
  }
  cout << maxx;
  return 0;
}
