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