#include <bits/stdc++.h>
using namespace std;
const long long dx[] = {-1, 0, 0, 1};
const long long dy[] = {0, -1, 1, 0};
const int Mass = (int)2e5 + 5;
const int inf = (int)1e9 + 5;
const long long linf = (long long)1e18 + 5;
const long long Mod = (long long)1e9 + 7;
long long ModFix(long long a, long long Mod) {
  return ((((a) % (Mod)) + (Mod)) % (Mod));
}
long long ModSum(long long a, long long b, long long Mod) {
  return ModFix(((a) + (b)), (Mod));
}
long long ModSub(long long a, long long b, long long Mod) {
  return ModFix(((a) - (b)), (Mod));
}
long long ModMul(long long a, long long b, long long Mod) {
  return ModFix(((a) * (b)), (Mod));
}
int a[150];
int main() {
  ios_base ::sync_with_stdio(false);
  cin.tie(NULL);
  int n, m;
  cin >> n;
  cin >> m;
  int res = 0;
  for (int i = 1; i <= n; ++i) cin >> a[i];
  for (int i = 1; i <= m; ++i) {
    int l, r;
    cin >> l >> r;
    int sum = 0;
    for (int j = l; j <= r; ++j) {
      sum += a[j];
    }
    if (sum >= 0) res += sum;
  }
  cout << res;
  return 0;
}
