#include <bits/stdc++.h>
using namespace std;
int x[110], s[110];
int main() {
  int n, m;
  cin >> n >> m;
  for (int i = (1); i < (n + 1); i++) cin >> x[i];
  for (int i = (1); i < (n + 1); i++) s[i] = s[i - 1] + x[i];
  int v = 0;
  while (m--) {
    int l, r;
    cin >> l >> r;
    if (s[r] - s[l - 1] > 0) v += s[r] - s[l - 1];
  }
  cout << v << "\n";
  return 0;
}
