#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  long long n, m, arr[200], sum[200], a, b, ans = 0;
  cin >> n >> m;
  sum[0] = 0;
  for (long long i = 1; i <= n; i++) {
    cin >> arr[i];
    sum[i] = sum[i - 1] + arr[i];
  }
  for (long long i = 1; i <= m; i++) {
    cin >> a >> b;
    arr[i] = sum[b] - sum[a - 1];
  }
  for (long long i = 1; i <= m; i++) {
    if (arr[i] > 0) ans += arr[i];
  }
  cout << ans << endl;
}
