#include <bits/stdc++.h>
using namespace std;
int n, m, sum, x, y, ans = 0;
int main() {
  cin >> n >> m;
  int a[n], d[n];
  memset(d, 0, sizeof(d));
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < m; i++) {
    cin >> x >> y;
    sum = 0;
    for (int j = x - 1; j <= y - 1; j++) {
      sum += a[j];
    }
    if (sum > 0)
      for (int j = x - 1; j <= y - 1; j++) d[j]++;
  }
  for (int i = 0; i < n; i++) ans += d[i] * a[i];
  cout << ans;
  return 0;
}
