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