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