#include <bits/stdc++.h>
using namespace std;
int A[104], N, M;
int main() {
  int i, j;
  cin >> N >> M;
  for (i = 0; i < N; ++i) {
    cin >> A[i];
  }
  int ans = 0, l, r, s;
  for (i = 0; i < M; ++i) {
    cin >> l >> r;
    s = 0;
    for (j = l - 1; j < r; ++j) {
      s += A[j];
    }
    if (s > 0) {
      ans += s;
    }
  }
  cout << ans << '\n';
  return 0;
}
