#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  vector<int> data(n);
  for (int i = 0; i < n; ++i) {
    cin >> data[i];
  }
  int l, r, res, ans = 0;
  for (int i = 0; i < m; ++i) {
    cin >> l >> r;
    --l;
    res = 0;
    for (int k = l; k < r; ++k) {
      res += data[k];
    }
    if (res > 0) {
      ans += res;
    }
  }
  cout << ans;
  return 0;
}
