#include <bits/stdc++.h>
using namespace std;
long long n, m, mahdie, a[128], b[128];
int main() {
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    a[i] += a[i - 1];
  }
  int x, y;
  for (int i = 1; i <= m; i++) {
    cin >> x >> y;
    if (a[y] - a[x - 1] > 0) mahdie += a[y] - a[x - 1];
  }
  cout << mahdie;
}
