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