#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  long long int n, m;
  cin >> n >> m;
  long long int ans = 0;
  long long int a[1000] = {0};
  for (long long int i = 1; i <= n; i++) {
    cin >> a[i];
    a[i] += a[i - 1];
  }
  vector<long long int> v;
  while (m--) {
    long long int l, r;
    cin >> l >> r;
    v.push_back(a[r] - a[l - 1]);
  }
  sort(v.begin(), v.end());
  long long int i = 0;
  while (v[i] < 0 && i < v.size()) i++;
  while (i < v.size()) {
    ans += v[i++];
  }
  cout << ans;
  return 0;
}
