#include <bits/stdc++.h>
using namespace std;
const int N = 3e5 + 10;
const int LOGN = 20;
const int oo = 2e9;
const long long M = 1e9 + 7;
const int pi = acos(-1);
int n, m, a[N];
int ans;
vector<int> v;
int main() {
  cin >> n >> m;
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0, l, r; i < m; i++) {
    cin >> l >> r;
    l--, r--;
    int k = 0;
    for (int j = l; j <= r; j++) {
      k += a[j];
    }
    v.push_back(k);
  }
  for (int i = 0; i < v.size(); i++)
    if (v[i] > 0) ans += v[i];
  cout << ans << endl;
  return 0;
}
