#include <bits/stdc++.h>
using namespace std;
int xx[] = {0, 1, 0, -1, -1, -1, 1, 1, -1};
int yy[] = {1, 0, -1, 0, 1, 1, -1, -1};
void vin(vector<int> &v, int n) {
  int temp;
  while (n--) {
    cin >> temp;
    v.push_back(temp);
  }
}
int gcd(int a, int b) {
  if (a == 0)
    return b;
  else
    return gcd(b % a, a);
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n, m;
  cin >> n >> m;
  vector<int> arr;
  vin(arr, n);
  int aa = m;
  int a, b;
  vector<int> store;
  while (aa--) {
    cin >> a >> b;
    a--;
    b--;
    int sm = 0;
    for (int i = a; i <= b; i++) {
      sm += arr[i];
    }
    store.push_back(sm);
  }
  sort(store.rbegin(), store.rend());
  int ans = 0;
  for (auto a : store) {
    if (a < 0) break;
    ans += a;
  }
  cout << ans;
  return 0;
}
