#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, q, i, sum = 0, l, r, j;
  cin >> n >> q;
  int a[n];
  for (i = 0; i < n; i++) cin >> a[i];
  while (q--) {
    cin >> l >> r;
    long long int temp = 0;
    for (i = l - 1; i <= r - 1; i++) temp += a[i];
    if (temp > 0) sum += temp;
  }
  cout << sum << '\n';
}
