#include <bits/stdc++.h>
using namespace std;
const int maxn = 5e5 + 100;
int S[maxn], ans;
int main() {
  int popi = 0;
  popi++;
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n, m, p;
  cin >> n >> m;
  S[0] = 0;
  for (int i = 1; i <= n; i++) {
    cin >> p;
    S[i] = S[i - 1] + p;
  }
  for (int i = 0; i < m; i++) {
    int l, r;
    cin >> l >> r;
    ans += max(0, S[r] - S[l - 1]);
  }
  cout << ans << '\n';
  return 0;
}
