#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  int n, m;
  cin >> n >> m;
  vector<int> a(n);
  for (auto &x : a) {
    cin >> x;
  }
  vector<int> b(1, 0);
  for (auto x : a) {
    b.push_back(x + b.back());
  }
  int ans = 0;
  while (m--) {
    int l, r;
    cin >> l >> r;
    int s = b[r] - b[l - 1];
    if (s > 0) {
      ans += s;
    }
  }
  cout << ans << endl;
}
