#include <bits/stdc++.h>
using namespace std;
int main() {
  int m, n;
  cin >> m >> n;
  int k[m];
  for (int i = 0; i < m; i++) {
    cin >> k[i];
  }
  int a[n][2];
  int max = 0;
  for (int i = 0; i < n; i++) {
    cin >> a[i][0] >> a[i][1];
    int mi = a[i][0];
    int ma = a[i][1];
    a[i][2] = 0;
    for (int x = mi - 1; x <= ma - 1; x++) {
      a[i][2] += k[x];
    }
    if (a[i][2] > 0) max = a[i][2] + max;
  }
  cout << max << endl;
  return 0;
}
