#include <bits/stdc++.h>
using namespace std;
int a[105];
int main() {
  int n, m;
  while (~scanf("%d%d", &n, &m)) {
    for (int i = 1; i <= n; i++) {
      scanf("%d", &a[i]);
      a[i] += a[i - 1];
    }
    int q, p;
    int sum = 0;
    for (int i = 0; i < m; i++) {
      scanf("%d%d", &q, &p);
      int s = a[p] - a[q - 1];
      if (s > 0) sum += s;
    }
    printf("%d\n", sum);
  }
}
