#include <bits/stdc++.h>
using namespace std;
int N, M, a[128], dem[128];
int main() {
  int aa, b;
  cin >> N >> M;
  for (int i = 1; i <= N; ++i) {
    cin >> a[i];
  }
  for (int i = 1; i <= M; ++i) {
    cin >> aa >> b;
    for (int j = aa; j <= b; ++j) {
      dem[i] += a[j];
    }
  }
  int ans = 0;
  for (int i = 1; i <= M; ++i) {
    if (dem[i] > 0) ans += dem[i];
  }
  cout << ans << "\n";
  return 0;
}
