#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n, m, i, j, c;
  cin >> n >> m;
  int a[n], l[m], r[m], f[m];
  for (i = 0; i < n; i++) cin >> a[i];
  for (i = 0; i < m; i++) {
    cin >> l[i] >> r[i];
    l[i]--;
    r[i]--;
  }
  long long int s;
  for (i = 0; i < m; i++) {
    f[i] = 0;
    s = 0;
    for (j = 0; j < n; j++) {
      if (j >= l[i] && j <= r[i]) s += a[j];
    }
    if (s >= 0) f[i] = 1;
  }
  s = 0;
  for (i = 0; i < n; i++) {
    c = 0;
    for (j = 0; j < m; j++) {
      if (f[j] && i >= l[j] && i <= r[j]) c++;
    }
    s += (c * a[i]);
  }
  cout << s;
  return 0;
}
