#include <bits/stdc++.h>
using namespace std;
int a[150];
int fre[150];
int main() {
  int n, m;
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  for (int i = 2; i <= n; i++) {
    a[i] = a[i] + a[i - 1];
  }
  int i, j, l, r;
  int sum = 0;
  for (i = 1; i <= m; i++) {
    cin >> l;
    cin >> r;
    if (a[r] - a[l - 1] > 0) {
      sum += a[r] - a[l - 1];
    }
  }
  cout << sum << "\n";
  return 0;
}
