#include <bits/stdc++.h>
using namespace std;
const int oo = int(2e9) + 9;
const double eps = 1e-9;
const double pi = 3.14159265358979323846264338327950;
int sum[105];
int main() {
  int n, m;
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    int x;
    cin >> x;
    sum[i] = sum[i - 1] + x;
  }
  int ans = 0;
  while (m--) {
    int l, r;
    cin >> l >> r;
    int x = sum[r] - sum[l - 1];
    if (x > 0) ans += x;
  }
  cout << ans << endl;
  return 0;
}
