#include <bits/stdc++.h>
using namespace std;
int main() {
  ios ::sync_with_stdio(false);
  cin.tie(0);
  ;
  int n, m;
  cin >> n >> m;
  vector<int> a(n), b(n);
  for (auto& x : a) cin >> x;
  ;
  while (m--) {
    int x, y;
    cin >> x >> y;
    if (x == y and a[x - 1] > 0)
      b[x - 1]++;
    else {
      int sum = 0;
      for (int i = x - 1; i <= y - 1; i++) sum += a[i];
      if (sum > 0) {
        for (int i = x - 1; i <= y - 1; i++) b[i]++;
      }
    }
  }
  long long int sum = 0;
  for (int i = 0; i < n; i++) {
    sum += (a[i] * b[i]);
  }
  cout << sum;
}
