#include <bits/stdc++.h>
using namespace std;
template <class T>
inline T bigmod(T p, T e, T M) {
  long long ret = 1;
  for (; e > 0; e >>= 1) {
    if (e & 1) ret = (ret * p) % M;
    p = (p * p) % M;
  }
  return (T)ret;
}
template <class T>
inline T gcd(T a, T b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
template <class T>
inline T modinverse(T a, T M) {
  return bigmod(a, M - 2, M);
}
long long A[110], st[500];
void build(int p, int l, int r) {
  if (l == r) {
    st[p] = A[l];
    return;
  }
  build(2 * p, l, (l + r) / 2);
  build(2 * p + 1, (l + r) / 2 + 1, r);
  st[p] = st[2 * p] + st[2 * p + 1];
}
long long rsq(int p, int l, int r, int i, int j) {
  if (i > r || j < l) return 0;
  if (l >= i && r <= j) return st[p];
  return rsq(p * 2, l, (l + r) / 2, i, j) +
         rsq(2 * p + 1, (l + r) / 2 + 1, r, i, j);
}
int main(int argc, char const *argv[]) {
  int n, m;
  cin >> n >> m;
  for (int i = 0; i < n; i++) cin >> A[i];
  build(1, 0, n - 1);
  long long sum = 0;
  int l, r;
  vector<long long> v;
  while (m--) {
    cin >> l >> r;
    v.push_back(rsq(1, 0, n - 1, l - 1, r - 1));
  }
  sort(v.begin(), v.end(), greater<long long>());
  if (v[0] <= 0) {
    cout << "0";
    return 0;
  }
  int i = 0;
  while (v[i] > 0 && i < v.size()) {
    sum += v[i++];
  }
  cout << sum;
  return 0;
}
