#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  while (cin >> n >> m) {
    int b, c, d, e, f, g[110] = {0}, h, i, j, k, l[110], o, p, q, r[110],
                       s[110] = {0}, t, u, v, w, x, y, z;
    int max = 0;
    int a[110] = {0}, co[110] = {0};
    for (i = 0; i < n; i++) {
      cin >> a[i];
    }
    for (i = 0; i < m; i++) {
      cin >> l[i] >> r[i];
      for (j = l[i] - 1; j < r[i]; j++) {
        g[i] += a[j];
      }
      if (g[i] > 0) {
        for (j = l[i] - 1; j < r[i]; j++) {
          co[j]++;
        }
      }
    }
    for (i = 0; i < n; i++) {
      max += a[i] * co[i];
    }
    cout << max << endl;
  }
  return 0;
}
