#include <bits/stdc++.h>
using namespace std;
const int NR = 1e5 + 10;
void Min(int& x, int y) { x = min(x, y); }
void Max(int& x, int y) { x = max(x, y); }
int read() {
  int x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = (x << 3) + (x << 1) + (ch ^ 48);
    ch = getchar();
  }
  return x * f;
}
int n, m, q, now;
long long ans;
int a[NR], b[NR];
int p[NR], num[NR], all;
int getid(int x) {
  int l = 1, r = all, res = -1;
  while (l <= r) {
    int mid = (l + r) / 2;
    if (num[mid] <= x)
      res = mid, l = mid + 1;
    else
      r = mid - 1;
  }
  return res;
}
int to[NR], nxt[NR], head[NR], tot = 1;
void add(int x, int y) { to[tot] = y, nxt[tot] = head[x], head[x] = tot++; }
struct Bcj {
  int fa[NR], siz[NR];
  void init() {
    for (int i = 1; i <= n; i++) fa[i] = i, siz[i] = 1;
  }
  int find(int x) { return (x == fa[x]) ? x : fa[x] = find(fa[x]); }
  void merge(int x, int y) {
    int fx = find(x), fy = find(y);
    if (fx == fy) return;
    ans += 1ll * num[now] * siz[fx] * siz[fy];
    fa[fx] = fy;
    siz[fy] += siz[fx];
  }
} T;
int main() {
  n = read(), q = read();
  p[0] = -1000000000;
  for (int i = 1; i <= n; i++) a[i] = read();
  for (int i = 2; i <= n; i++) p[i - 1] = abs(a[i] - a[i - 1]);
  sort(p + 1, p + n);
  for (int i = 1; i < n; i++)
    if (p[i] != p[i - 1]) num[++all] = p[i];
  while (q--) {
    memset(head, 0, sizeof(head));
    T.init();
    int l = read(), r = read();
    m = 0;
    tot = 1;
    ans = 0;
    for (int i = l + 1; i <= r; i++) b[++m] = getid(abs(a[i] - a[i - 1]));
    for (int i = 1; i <= m; i++) add(b[i], i + l);
    for (int x = 1; x <= all; x++) {
      now = x;
      for (int i = head[x]; i; i = nxt[i]) T.merge(to[i] - 1, to[i]);
    }
    printf("%lld\n", ans);
  }
  return 0;
}
