#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
const int M = 1e4 + 10;
const int MOD = 1e9 + 7;
const int inf = 1e9;
const double pi = acos(-1.0);
const double eps = 1e-6;
int dx[] = {0, -1, 0, 1};
int dy[] = {1, 0, -1, 0};
int n, m;
int a[101];
int sum[102];
int l, r;
int res;
int main() {
  cin >> n >> m;
  sum[0] = 0;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    sum[i + 1] += sum[i] + a[i];
  }
  for (int i = 0; i < m; i++) {
    cin >> l >> r;
    int v = sum[r] - sum[l - 1];
    if (v > 0) res += v;
  }
  cout << res;
  return 0;
}
