#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
const int inf = 0x3f3f3f3f;
const double eps = 1e-7;
int a[110];
int b[110];
int main() {
  int n, m;
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    a[i] += a[i - 1];
  }
  for (int i = 1; i <= m; i++) {
    int l, r;
    cin >> l >> r;
    b[i] = a[r] - a[l - 1];
  }
  sort(b + 1, b + 1 + m);
  int ans = 0;
  for (int i = m; i >= 1; i--)
    if (b[i] > 0) ans += b[i];
  cout << ans << endl;
  return 0;
}
