#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  int arr[n];
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
  }
  long int answer = 0;
  while (m != 0) {
    m--;
    int a, b;
    cin >> a >> b;
    int sum = 0;
    for (int i = a - 1; i < b; i++) {
      sum += arr[i];
    }
    if (sum > 0) {
      answer += sum;
    }
  }
  cout << answer;
  return 0;
}
