#include <bits/stdc++.h>
using namespace std;
void filestd() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}
int n, m, x, y, ans;
int mas[200];
int main() {
  cin >> n >> m;
  for (int i = 1; i <= n; i++) cin >> mas[i];
  for (int i = 1; i <= m; i++) {
    int cur = 0;
    cin >> x >> y;
    for (int j = x; j <= y; j++) cur += mas[j];
    if (cur > 0) ans += cur;
  }
  cout << ans;
}
