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