#include <bits/stdc++.h>
using namespace std;
const int N = 100 + 10;
int a[N];
int main() {
  int n, m;
  cin >> n >> m;
  for (int i = 0; i <= n - 1; i++) cin >> a[i];
  long long ans = 0;
  for (int i = 0; i <= m - 1; i++) {
    int l, r;
    cin >> l >> r;
    l--;
    r--;
    long long x = 0;
    for (int j = l; j <= r; j++) x += a[j];
    ans += max(0LL, x);
  }
  cout << ans << endl;
  return 0;
}
