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