#include <bits/stdc++.h>
using namespace std;
vector<int> t;
int n;
void init(int nn) {
  n = nn;
  t.assign(n, 0);
}
int sum(int r) {
  int result = 0;
  for (; r >= 0; r = (r & (r + 1)) - 1) result += t[r];
  return result;
}
void inc(int i, int delta) {
  for (; i < n; i = (i | (i + 1))) t[i] += delta;
}
int sum(int l, int r) { return sum(r) - sum(l - 1); }
void init(vector<int> a) {
  init((int)a.size());
  for (unsigned i = 0; i < a.size(); i++) inc(i, a[i]);
}
int main() {
  int count, k;
  cin >> count >> k;
  vector<int> a;
  for (int i = 0; i < count; ++i) {
    int tmp;
    cin >> tmp;
    a.push_back(tmp);
  }
  vector<pair<int, int> > borders;
  for (int i = 0; i < k; ++i) {
    int left;
    int right;
    cin >> left >> right;
    borders.push_back(make_pair(left, right));
  }
  init(a);
  long long s = 0;
  for (int i = 0; i < k; ++i) {
    int tmp = sum(borders[i].first - 1, borders[i].second - 1);
    if (tmp > 0) {
      s += tmp;
    }
  }
  cout << s;
}
