#include <bits/stdc++.h>
using namespace std;
const int MAX = 110;
int n, m;
int a[MAX];
int pre[MAX];
int main() {
  int i, j, l;
  while (~scanf("%d%d", &n, &m)) {
    pre[0] = 0;
    for (i = 1; i <= n; i++) {
      scanf("%d", &a[i]);
      pre[i] = pre[i - 1] + a[i];
    }
    int sum = 0;
    for (i = 1; i <= m; i++) {
      int l, r;
      scanf("%d%d", &l, &r);
      if (pre[r] - pre[l - 1] > 0) sum += pre[r] - pre[l - 1];
    }
    printf("%d\n", sum);
  }
  return 0;
}
