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