#include <bits/stdc++.h>
int n;
int m;
int a[1002];
int l;
int r;
int summ;
int bigsum = 0;
int i;
int main() {
  scanf("%d%d", &n, &m);
  for (i = 1; i <= n; i++) scanf("%d", &a[i]);
  while (m--) {
    scanf("%d%d", &l, &r);
    summ = 0;
    for (i = l; i <= r; i++) summ += a[i];
    if (summ > 0) bigsum += summ;
  }
  printf("%d", bigsum);
  return 0;
}
