#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  int a[105];
  cin >> n >> m;
  for (int i = 1; i <= n; i++) cin >> a[i];
  int sum1 = 0;
  while (m--) {
    int s, e;
    cin >> s >> e;
    int sum = 0;
    for (int i = s; i <= e; i++) sum += a[i];
    if (sum > 0) sum1 += sum;
  }
  cout << sum1 << endl;
  return 0;
}
