#include <bits/stdc++.h>
using namespace std;
int n, m, a[105], l, r, happiness = 0;
vector<int> v;
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
  }
  for (int i = 1; i <= m; i++) {
    scanf("%d%d", &l, &r);
    int sum = 0;
    for (int j = l; j <= r; j++) {
      sum += a[j];
    }
    v.push_back(sum);
  }
  for (int i = 0; i < v.size(); i++) {
    if (v[i] > 0) {
      happiness += v[i];
    }
  }
  printf("%d\n", happiness);
  return 0;
}
