#include <bits/stdc++.h>
using namespace std;
int n, m, l, r, k, final;
signed int arr[250], sum;
vector<int> v, u;
int main() {
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
  }
  while (m--) {
    cin >> l >> r;
    l--, r--;
    for (int i = l; i <= r; i++) sum = sum + arr[i];
    if (sum >= 0) {
      v.push_back(l);
      u.push_back(r);
    }
    sum = 0;
  }
  for (int j = 0; j < n; j++) {
    for (int i = 0; i < v.size(); i++) {
      if (j >= v[i] && j <= u[i]) k++;
    }
    arr[j] *= k;
    k = 0;
  }
  for (int i = 0; i < n; i++) final += arr[i];
  if (final <= 0)
    cout << 0 << endl;
  else
    cout << final << endl;
  return 0;
}
