#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, m, b, sum = 0;
  ;
  cin >> n >> m;
  vector<int> a[102];
  vector<int> k(1);
  k[0] = 0;
  for (int i = 0; i < n; i++) {
    cin >> b;
    k.push_back(b);
  }
  int x, y;
  for (int i = 1; i < m + 1; i++) {
    cin >> x >> y;
    for (int j = x; j < y + 1; j++) {
      a[i].push_back(k[j]);
    }
  }
  long long z = 0, sum1 = 0;
  for (int i = 1; i <= m + 1; i++) {
    for (int j = 0; j < a[i].size(); j++) {
      sum1 = sum1 + a[i][j];
    }
    if (sum1 > 0) {
      sum = sum + sum1;
    }
    sum1 = 0;
  }
  cout << sum;
  return 0;
}
