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