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