#include <bits/stdc++.h>
using namespace std;
template <class T>
inline void prin(const T &a, const char &ch) {
  cout << a << ch;
}
const int INF = 2147483647;
long long mini, maxi;
string no, yes;
void solve();
void testcase();
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  mini = INF;
  maxi = -INF;
  no = "NO";
  yes = "YES";
  solve();
  return 0;
}
void testcase() {
  cout << "\nTime elapsed: " << clock() / 1000 << " ms" << endl;
}
const int MAXN = 1111;
int mas[MAXN / 10];
map<int, int> d;
void solve() {
  int n, k;
  cin >> n >> k;
  for (int(i) = 0; i < (int)(n); ++i) cin >> mas[i];
  for (int(i) = 0; i < (int)(k); ++i) {
    int l = 0, r = 0;
    cin >> l >> r;
    l--;
    int buf = 0;
    for (int(j) = (l); j < (int)(r); j++) {
      buf += mas[j];
    }
    if (buf > 0) {
      for (int(j) = (l); j < (int)(r); j++) {
        d[j]++;
      }
    }
  }
  int ans = 0;
  for (auto i : d) {
    ans += mas[i.first] * i.second;
  }
  cout << ans;
}
