#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  vector<int> vec(n);
  for (int i = 0; i < n; i++) cin >> vec[i];
  vector<pair<int, int>> que;
  for (int i = 0; i < k; i++) {
    int l, m;
    cin >> l >> m;
    que.push_back({l, m});
  }
  vector<int> pre(n + 1, 0);
  int sum = 0;
  for (int i = 0; i < n; i++) {
    pre[i] = sum;
    sum += vec[i];
  }
  pre[n] = sum;
  sum = 0;
  for (int i = 0; i < k; i++) {
    int l = que[i].first - 1;
    int r = que[i].second;
    int x = pre[r] - pre[l];
    sum += (x > 0) ? x : 0;
  }
  cout << sum;
}
