#include <bits/stdc++.h>
using namespace std;
const int maxn = 105;
int n, m;
int a[maxn];
int p[maxn];
int main() {
  cin.sync_with_stdio(false);
  cin.tie(nullptr);
  cin >> n >> m;
  p[0] = 0;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    p[i] = p[i - 1] + a[i];
  }
  int l, r;
  long long sum = 0;
  for (int i = 1; i <= m; i++) {
    cin >> l >> r;
    if (p[r] - p[l - 1] > 0) sum += p[r] - p[l - 1];
  }
  cout << sum << endl;
  return 0;
}
