#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int n, m;
  cin >> n >> m;
  int a[n + 1];
  int b[n + 1];
  memset(b, 0, sizeof b);
  map<int, int> mp;
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int i = 1; i <= m; i++) {
    int x, y;
    cin >> x >> y;
    for (int j = min(x, y); j <= max(x, y); j++) mp[i] += a[j];
    if (mp[i] > 0)
      for (int j = min(x, y); j <= max(x, y); j++) b[j]++;
  }
  long long res = 0;
  for (int i = 1; i <= n; i++)
    if (b[i] > 0) res += 1LL * a[i] * b[i];
  cout << res << endl;
  return 0;
}
