#include <bits/stdc++.h>
using namespace std;
int n, m, a[300], s[300];
int main(void) {
  unsigned long long ans = 0;
  scanf("%d%d", &n, &m);
  for (register int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    s[i] = s[i - 1] + a[i];
  }
  while (m--) {
    int u, v;
    scanf("%d%d", &u, &v);
    if (s[v] - s[u - 1] > 0) ans += s[v] - s[u - 1];
  }
  cout << ans;
  return 0;
}
