#include <bits/stdc++.h>
using namespace std;
const long long inf = (long long)5e18;
const long long N = 120000;
long long n, a[N], m, b[N];
long long pre[N], nxt[N];
long long q[N], top = 0;
long long _abs(long long x) { return x < 0 ? -x : x; }
void solve() {
  scanf("%lld%lld", &n, &m);
  for (long long i = 1; i <= n; i++) {
    scanf("%lld", &a[i]);
    if (i > 1) b[i - 1] = _abs(a[i] - a[i - 1]);
  }
  b[0] = b[n] = inf;
  q[++top] = 0;
  for (long long i = 1; i <= n; i++) {
    while (b[q[top]] < b[i]) nxt[q[top]] = i, top--;
    pre[i] = q[top];
    q[++top] = i;
  }
  while (m--) {
    long long ans = 0;
    long long l, r;
    scanf("%lld%lld", &l, &r);
    r--;
    for (long long i = l; i <= r; i++) {
      long long L = max(l, pre[i] + 1);
      long long R = min(r, nxt[i] - 1);
      ans += (R - i + 1) * (i - L + 1) * b[i];
    }
    printf("%lld\n", ans);
  }
}
signed main() {
  long long TTT = 1;
  while (TTT--) {
    solve();
  }
  return 0;
}
