#include <bits/stdc++.h>
using namespace std;
inline long long read() {
  long long num = 0, neg = 1;
  char c = getchar();
  while (!isdigit(c)) {
    if (c == '-') neg = -1;
    c = getchar();
  }
  while (isdigit(c)) {
    num = (num << 3) + (num << 1) + c - '0';
    c = getchar();
  }
  return num * neg;
}
long long n, m, a[110], sum[110], ans;
int main() {
  n = read(), m = read();
  for (int i = 1; i <= n; i++) a[i] = read(), sum[i] = sum[i - 1] + a[i];
  for (int i = 1; i <= m; i++) {
    int l = read(), r = read();
    if (sum[r] - sum[l - 1] > 0) ans += sum[r] - sum[l - 1];
  }
  cout << ans;
  return 0;
}
