#include <bits/stdc++.h>
using namespace std;
int sum[200];
int fre[150];
vector<int> v;
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  v.resize(n + 1);
  for (int i = 1, x; i <= n; ++i) {
    scanf("%d", &v[i]);
  }
  for (int i = 1; i <= n; ++i) sum[i] = sum[i - 1] + v[i];
  for (int i = 0, a, b; i < m; ++i) {
    scanf("%d%d", &a, &b);
    if (sum[b] - sum[a - 1] > 0) {
      for (int j = a; j <= b; ++j) fre[j]++;
    }
  }
  int total = 0;
  for (int i = 1; i <= n; ++i) {
    total += (v[i] * fre[i]);
  }
  cout << total << endl;
}
