#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  vector<int> a(n + 1);
  for (int i = 1; i <= n; i++) cin >> a[i];
  long int ans = 0;
  for (int i = 1; i <= m; i++) {
    int l, r;
    cin >> l >> r;
    long int sum = 0;
    for (int j = l; j <= r; j++) sum += a[j];
    if (sum >= 0) ans += sum;
  }
  cout << ans << endl;
  return (0);
}
