#include <bits/stdc++.h>
using namespace std;
const int N = 100500;
int a[N], b[N];
int main() {
  srand(time(NULL));
  int n, m;
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
  }
  for (int i = 1; i <= m; i++) {
    int l, r;
    scanf("%d%d", &l, &r);
    for (int j = l; j <= r; j++) {
      b[i] += a[j];
    }
  }
  int ans = 0;
  for (int i = 1; i <= m; i++)
    if (b[i] > 0) ans += b[i];
  cout << ans;
  return 0;
}
