#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, t[110], x, a, b;
  cin >> n >> m;
  int suma, res = 0, clave = 0;
  t[0] = 0;
  for (int i = 1; i <= n; i++) {
    cin >> x;
    t[i] = x + t[i - 1];
  }
  for (int i = 0; i < m; i++) {
    cin >> a >> b;
    suma = t[b] - t[a - 1];
    if (suma > 0) clave += suma;
  }
  cout << clave << endl;
  return 0;
}
