#include <bits/stdc++.h>
using namespace std;
int a[1005];
int main() {
  int n, m;
  while (~scanf("%d%d", &n, &m)) {
    for (int i = 1; i <= n; i++) {
      scanf("%d", &a[i]);
    }
    int output = 0;
    for (int i = 0; i < m; i++) {
      int x, y;
      scanf("%d%d", &x, &y);
      int cnt = 0;
      for (int j = x; j <= y; j++) {
        cnt += a[j];
      }
      if (cnt > 0) output += cnt;
    }
    printf("%d\n", output);
  }
}
