#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  vector<int> arr(n), preSum(n), countArr(n);
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
    if (i)
      preSum[i] = arr[i] + preSum[i - 1];
    else
      preSum[i] = arr[i];
    countArr[i] = 0;
  }
  int subSum, l, r;
  for (int i = 0; i < m; i++) {
    cin >> l >> r;
    if (l == 1)
      subSum = preSum[r - 1];
    else
      subSum = preSum[r - 1] - preSum[l - 2];
    if (subSum > 0)
      for (int j = l - 1; j < r; j++) countArr[j]++;
  }
  int ans = 0;
  for (int i = 0; i < n; i++) ans += countArr[i] * arr[i];
  cout << ans << endl;
  return 0;
}
