#include <bits/stdc++.h>
using namespace std;
int N, M;
long long m[101] = {}, A[101];
pair<int, int> B[101];
int main() {
  cin >> N >> M;
  for (int x = 0; x < N; x++) cin >> A[x + 1], A[x + 1] += A[x];
  long long total = 0;
  for (int x = 0; x < M; x++) {
    cin >> B[x].first >> B[x].second;
    total += max(A[B[x].second] - A[B[x].first - 1], 0LL);
  }
  cout << total << "\n";
}
