#include <bits/stdc++.h>
using namespace std;
int a[200];
int main() {
  int n, m;
  cin >> n >> m;
  for (int i = 0; i < n; i++) cin >> a[i];
  long long ans = 0;
  for (int i = 0; i < m; i++) {
    int x, y;
    cin >> x >> y;
    x--, y--;
    long long now = 0;
    for (int j = x; j <= y; j++) now += a[j];
    if (now > 0) ans += now;
  }
  cout << ans << '\n';
  return 0;
}
