#include <bits/stdc++.h>
using namespace std;
int a[100 + 5];
int b[100 + 5];
int main() {
  int m, n;
  int l, r;
  while (scanf("%d%d", &m, &n) != EOF) {
    int sum = 0;
    for (int i = 1; i <= m; i++) cin >> a[i];
    for (int i = 1; i <= n; i++) {
      cin >> l >> r;
      int sum1 = 0;
      for (int i = l; i <= r; i++) {
        sum1 += a[i];
      }
      if (sum1 > 0) sum += sum1;
    }
    cout << sum << endl;
  }
  return 0;
}
