#include <bits/stdc++.h>
using namespace std;
const double EPS = 1e-7;
const long long SZ = 100010, SSZ = 120, APB = 52, one = 11;
const long long INF = 0x7f7f7f7f7f7f7f7f, mod = 1000000007;
long long n, qnum, src[SZ], diff[SZ];
struct nd {
  long long ll, rr, val, id;
  nd(long long a = 0, long long b = 0, long long c = 0, long long d = 0)
      : ll(a), rr(b), val(c), id(d) {}
};
nd arr[SZ];
void its(long long l1, long long r1, long long l2, long long r2, long long &u,
         long long &v) {
  u = max(l1, l2);
  v = min(r1, r2);
  if (u > v) u = v = -1;
}
void init() {
  cin >> n >> qnum;
  for (long long i = 1; i <= n; ++i) cin >> src[i];
  for (long long i = 1; i <= n - 1; ++i) {
    diff[i] = abs(src[i + 1] - src[i]);
  }
  deque<nd> dq;
  for (long long i = 1; i <= n - 1; ++i) {
    long long ll = i;
    for (; dq.size() && dq.back().val <= diff[i];) {
      nd tmp = dq.back();
      dq.pop_back();
      tmp.rr = i - 1;
      arr[tmp.id] = tmp;
      ll = min(ll, tmp.ll);
    }
    dq.push_back(nd(ll, i, diff[i], i));
  }
  for (; dq.size();) {
    nd tmp = dq.back();
    dq.pop_back();
    tmp.rr = n - 1;
    arr[tmp.id] = tmp;
  }
  for (long long i = 1; i <= n - 1; ++i) {
    ++arr[i].rr;
  }
  for (long long i = 1; i <= qnum; ++i) {
    long long ll, rr, res = 0, u, v;
    cin >> ll >> rr;
    for (long long j = 1; j <= n - 1; ++j) {
      its(ll, rr, arr[j].ll, arr[j].rr, u, v);
      if (u != -1) {
        long long num1 = j - u + 1;
        long long num2 = v - j;
        if (num1 < 0) num1 = 0;
        if (num2 < 0) num2 = 0;
        res += num1 * num2 * diff[j];
      }
    }
    cout << res << endl;
  }
}
void work() {}
int main() {
  std::ios::sync_with_stdio(0);
  int casenum;
  {
    init();
    work();
  }
  return 0;
}
