#include <bits/stdc++.h>
using namespace std;
const int N = 111;
int n, a[N], m;
int main() {
  scanf("%d %d", &n, &m);
  for (int i = 1; i <= n; i++) scanf("%d", a + i);
  int res = 0;
  while (m--) {
    int x, y;
    scanf("%d %d", &x, &y);
    int sum = 0;
    for (int i = x; i <= y; i++) sum += a[i];
    if (sum > 0) res += sum;
  }
  cout << res << endl;
}
