#include <bits/stdc++.h>
using namespace std;
int main() {
  cin.sync_with_stdio(false);
  int n, m;
  cin >> n >> m;
  int a[n];
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  int b[m];
  for (int i = 0; i < m; ++i) {
    int l, r;
    cin >> l >> r;
    l--, r--;
    int sum = 0;
    for (int j = l; j <= r; ++j) {
      sum += a[j];
    }
    b[i] = sum;
  }
  sort(b, b + m);
  int ans = 0;
  int i = m - 1;
  while (i >= 0 and b[i] > 0) {
    ans += b[i];
    i--;
  }
  cout << ans << endl;
  return 0;
}
