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