#include <bits/stdc++.h>
using namespace std;
int check(int arr[], int l, int r) {
  int i;
  int sum = 0;
  for (i = l; i <= r; i++) sum += arr[i - 1];
  return sum;
}
int main() {
  ios_base::sync_with_stdio(false);
  int n, m;
  cin >> n >> m;
  int i, arr[n], l[m], r[m];
  for (i = 0; i < n; i++) cin >> arr[i];
  for (i = 0; i < m; i++) cin >> l[i] >> r[i];
  int sum = 0, x;
  for (i = 0; i < m; i++) {
    x = check(arr, l[i], r[i]);
    if (x > 0) sum += x;
  }
  cout << sum << endl;
  return 0;
}
