#include <bits/stdc++.h>
using namespace std;
int arr[100001];
int tree[100001 * 3];
void init(int node, int b, int e) {
  if (b == e) {
    tree[node] = arr[b];
    return;
  }
  int Left = node * 2;
  int Right = node * 2 + 1;
  int mid = (b + e) / 2;
  init(Left, b, mid);
  init(Right, mid + 1, e);
  tree[node] = tree[Left] + tree[Right];
}
int query(int node, int b, int e, int i, int j) {
  if (i > e || j < b) return 0;
  if (b >= i && e <= j) return tree[node];
  int Left = node * 2;
  int Right = node * 2 + 1;
  int mid = (b + e) / 2;
  int p1 = query(Left, b, mid, i, j);
  int p2 = query(Right, mid + 1, e, i, j);
  return p1 + p2;
}
void update(int node, int b, int e, int i, int newvalue) {
  if (i > e || i < b) return;
  if (b >= i && e <= i) {
    tree[node] = newvalue;
    return;
  }
  int Left = node * 2;
  int Right = node * 2 + 1;
  int mid = (b + e) / 2;
  update(Left, b, mid, i, newvalue);
  update(Right, mid + 1, e, i, newvalue);
  tree[node] = tree[Left] + tree[Right];
}
int main() {
  int n, m;
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    cin >> arr[i];
  }
  init(1, 1, n);
  vector<int> v;
  while (m--) {
    int x, y;
    cin >> x >> y;
    int sum = query(1, 1, n, x, y);
    v.push_back(sum);
  }
  int ans = 0;
  for (int i = 0; i < v.size(); i++) {
    if (v[i] > 0) ans += v[i];
  }
  cout << ans << endl;
  return 0;
}
