#include <bits/stdc++.h>
using namespace std;
int a[105], v[105];
int main() {
  int n, m;
  cin >> n >> m;
  for (int i = 1; i <= n; i++) cin >> a[i];
  int x, y;
  int cn = 0, ans = 0;
  for (int i = 0; i < m; i++) {
    cn = 0;
    cin >> x >> y;
    for (int i = x; i <= y; i++) cn += a[i];
    if (cn >= 0) ans += cn;
  }
  cout << ans << endl;
}
