#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  int l, r;
  int s = 0;
  int v = 0;
  cin >> n >> m;
  int* a = new int[n];
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < m; i++) {
    cin >> l >> r;
    v = 0;
    for (int j = l - 1; j < r; j++) v = v + a[j];
    if (v >= 0) s = s + v;
  }
  cout << s << endl;
  delete[] a;
  return 0;
}
