#include <bits/stdc++.h>
using namespace std;
const int N = 200;
int n, m, a[N], s = 0, ss;
int p1, p2;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie();
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  for (int i = 1; i <= m; i++) {
    cin >> p1 >> p2;
    ss = 0;
    for (int i = p1; i <= p2; i++) {
      ss = ss + a[i];
    }
    if (ss > 0) {
      s = s + ss;
    }
  }
  cout << s;
  return 0;
}
