#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, m;
  cin >> n >> m;
  long long arr[n + 1];
  for (int i = 0; i < n; i++) {
    cin >> arr[i + 1];
  }
  long long psum[n + 1];
  psum[1] = arr[1];
  for (int i = 2; i < n + 1; ++i) {
    psum[i] = psum[i - 1] + arr[i];
  }
  long long ans = 0;
  for (int i = 1; i < m + 1; ++i) {
    int l, r;
    scanf("%d%d", &l, &r);
    if (psum[r] - psum[l] + arr[l] <= 0) {
      continue;
    } else {
      ans += psum[r] - psum[l] + arr[l];
    }
  }
  cout << ans;
}
