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