#include <bits/stdc++.h>
using namespace std;
int main() {
  int arr[105], arr2[105], n, m, a, l, r, ans = 0;
  memset(arr, 0, 105);
  memset(arr2, 0, 105);
  scanf("%d %d", &n, &m);
  arr2[0] = 0;
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a);
    arr2[i] = arr2[i - 1] + a;
  }
  for (int i = 1; i <= m; i++) {
    scanf("%d %d", &l, &r);
    arr[i] = arr2[r] - arr2[l - 1];
  }
  sort(arr + 1, arr + 1 + m);
  for (int i = 1; i <= m; i++) {
    ans = ans + max(0, arr[i]);
  }
  printf("%d\n", ans);
  return 0;
}
