#include <bits/stdc++.h>
using namespace std;
int n, m, s[105], ans, tmp;
int main() {
  scanf("%d %d", &n, &m);
  for (int i = (1); i <= (n); i++) scanf("%d", &s[i]);
  for (int i = (1); i <= (m); i++) {
    int l, r;
    scanf("%d %d", &l, &r);
    tmp = 0;
    for (int j = (l); j <= (r); j++) tmp += s[j];
    if (tmp > 0) ans += tmp;
  }
  printf("%d\n", ans);
  return 0;
}
