#include <bits/stdc++.h>
using namespace std;
int main() {
  long i, n, m, a[101], dp[101], rez, l, d;
  scanf("%ld%ld", &n, &m);
  dp[0] = 0;
  for (i = 1; i <= n; i++) {
    scanf("%ld", &a[i]);
    dp[i] = dp[i - 1] + a[i];
  }
  rez = 0;
  for (i = 1; i <= m; i++) {
    scanf("%ld%ld", &l, &d);
    if (dp[d] - dp[l - 1] > 0) rez += dp[d] - dp[l - 1];
  }
  printf("%ld", rez);
  return 0;
}
