#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, q;
  cin >> n >> q;
  int *arr = new int[n];
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
  }
  for (int i = 1; i < n; i++) {
    arr[i] = arr[i] + arr[i - 1];
  }
  int temp = q;
  vector<int> v;
  int mm1 = -100;
  int mm2 = -1;
  while (temp--) {
    int a, b;
    cin >> a >> b;
    a--;
    b--;
    int sum = 0;
    if (a != 0)
      sum = arr[b] - arr[a - 1];
    else
      sum = arr[b];
    if (sum > 0) v.push_back(sum);
  }
  int ans = 0;
  for (int i = 0; i < v.size(); i++) {
    ans += v[i];
  }
  cout << ans;
  return 0;
}
