#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  int n, m;
  cin >> n >> m;
  vector<int> md(n);
  for (int i = 0; i < n; ++i) cin >> md[i];
  for (int i = 1; i < n; ++i) md[i] += md[i - 1];
  int ans = 0;
  for (int i = 0; i < m; ++i) {
    int l, r;
    cin >> l >> r;
    --l, --r;
    int s = md[r];
    if (l > 0) s -= md[l - 1];
    if (s > 0) ans += s;
  }
  cout << ans << endl;
  return 0;
}
