#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, m;
  cin >> n >> m;
  vector<long long> v(n);
  for (long long i = 0; i < n; i++) {
    cin >> v[i];
  }
  long long ans = 0;
  for (long long i = 0; i < m; i++) {
    long long l, r;
    cin >> l >> r;
    long long happ = 0;
    for (long long j = l; j <= r; j++) {
      happ += v[j - 1];
    }
    if (happ > 0) {
      ans += happ;
    }
  }
  cout << ans;
  return 0;
}
