#include <bits/stdc++.h>
using namespace std;
int n, m, ans, s[105];
inline int read() {
  int ret = 0, f = 1;
  char ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') f = -f;
    ch = getchar();
  }
  while (isdigit(ch)) ret = ret * 10 + ch - '0', ch = getchar();
  return ret * f;
}
int main() {
  n = read();
  m = read();
  for (int i = 1; i <= n; i++) s[i] = s[i - 1] + read();
  for (int i = 1; i <= m; i++) {
    int L = read(), R = read();
    if (s[R] - s[L - 1] > 0) ans += s[R] - s[L - 1];
  }
  printf("%d\n", ans);
  return 0;
}
