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