#include <bits/stdc++.h>
using namespace std;
vector<int> v;
vector<int> vsa;
long long n, sol = 0;
int main() {
  long long k, aux, a, b, q, m;
  cin >> n >> m;
  int sum = 0;
  vsa.push_back(0);
  for (int i = 0; i < n; i++) {
    cin >> q;
    sum += q;
    vsa.push_back(sum);
  }
  for (int i = 0; i < m; i++) {
    cin >> a >> b;
    int u = vsa[b] - vsa[a - 1];
    if (u > 0) sol += u;
  }
  cout << sol;
}
