#include <bits/stdc++.h>
using namespace std;
int n, m, i, j, a[105], l, r, c, res;
int main() {
  cin >> n >> m;
  for (i = 1; i <= n; i++) cin >> a[i];
  for (i = 0; i < m; i++) {
    cin >> l >> r;
    for (j = l; j <= r; j++) c += a[j];
    if (c > 0) res += c;
    c = 0;
  }
  cout << res;
  return 0;
}
