#include <bits/stdc++.h>
using namespace std;
int a[1000], n, m, t, r, super;
int main() {
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    a[i] += a[i - 1];
  }
  for (int i = 0; i < m; i++) {
    cin >> t >> r;
    if (a[r] - a[t - 1] > 0) super += a[r] - a[t - 1];
  }
  cout << super << endl;
}
