#include <bits/stdc++.h>
using namespace std;
int arr[150];
int main() {
  int n, m;
  cin >> n >> m;
  for (int i = 0; i < n; i++) cin >> arr[i];
  int ans = 0, sum;
  for (int i = 0; i < m; i++) {
    int x, y;
    cin >> x >> y;
    x--, y--;
    sum = 0;
    for (int j = x; j <= y; j++) sum += arr[j];
    if (sum > 0) ans += sum;
  }
  cout << ans << endl;
  return 0;
}
