#include <bits/stdc++.h>
const double PI = acos(-1);
using namespace std;
const int mod = 1e9 + 7;
using namespace std;
int main() {
  int n, m, l, r, temp;
  cin >> n >> m;
  int a[n];
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  int tot = 0;
  for (int k = 1; k <= m; k++) {
    temp = 0;
    cin >> l >> r;
    for (int i = l; i <= r; i++) {
      temp += a[i];
    }
    if (temp > 0) tot += temp;
  }
  cout << tot;
}
