#include <bits/stdc++.h>
const int maxn = 100 + 5;
struct node {
  int l, r;
  int ans;
} b[maxn];
int a[maxn];
int main() {
  int n, m;
  while (scanf("%d%d", &n, &m) != EOF) {
    for (int i = 1; i <= n; ++i) {
      scanf("%d", &a[i]);
    }
    for (int i = 0; i < m; ++i) {
      b[i].ans = 0;
      scanf("%d%d", &b[i].l, &b[i].r);
      for (int j = b[i].l; j <= b[i].r; ++j) b[i].ans += a[j];
    }
    int aa = 0;
    for (int i = 0; i < m; ++i) {
      if (b[i].ans > 0) aa += b[i].ans;
    }
    printf("%d\n", aa);
  }
  return 0;
}
