#include <bits/stdc++.h>
using namespace std;
template <typename T>
bool chmax(T& a, const T& b) {
  return a < b ? (a = b, true) : false;
}
template <typename T>
bool chmin(T& a, const T& b) {
  return b < a ? (a = b, true) : false;
}
class UnionFind {
 private:
  vector<int> parent;
  vector<int> sz;

 public:
  UnionFind(int n) : parent(n), sz(n, 1) {
    for (int i = 0; i < n; i++) parent[i] = i;
  }
  int find(int x) {
    if (parent[x] == x) return x;
    return parent[x] = find(parent[x]);
  }
  bool connect(int x, int y) {
    x = find(x), y = find(y);
    if (x == y) return false;
    if (sz[x] < sz[y]) swap(x, y);
    parent[y] = x;
    sz[x] += sz[y];
    return true;
  }
  bool same(int x, int y) { return find(x) == find(y); }
  int size(int x) { return sz[find(x)]; }
};
int N, Q;
bool used[100000];
bool in_range(int x) { return x >= 0 && x < N - 1; }
int main() {
  scanf("%d%d", &N, &Q);
  vector<long long> A(N);
  for (int i = (0); i < (N); i++) {
    scanf("%lld", &A[i]);
  }
  vector<pair<long long, int> > B(N - 1);
  for (int i = (0); i < (N - 1); i++) {
    A[i] = abs(A[i + 1] - A[i]);
    B[i] = {A[i], i};
  }
  A.pop_back();
  sort((B).begin(), (B).end());
  vector<long long> ans(Q);
  vector<pair<int, int> > query(Q);
  for (int i = (0); i < (Q); i++) {
    scanf("%d%d", &query[i].first, &query[i].second);
    query[i].first--;
    query[i].second--;
  }
  UnionFind uf(N - 1);
  for (int i = (0); i < (N - 1); i++) {
    int idx = B[i].second, l = B[i].second, r = B[i].second + 1;
    if (in_range(idx - 1) && used[idx - 1]) {
      l = max(0, l - uf.size(idx - 1));
      uf.connect(idx, idx - 1);
    }
    if (in_range(idx + 1) && used[idx + 1]) {
      r = min(N - 1, r + uf.size(idx + 1));
      uf.connect(idx, idx + 1);
    }
    used[idx] = true;
    for (int j = (0); j < (Q); j++)
      if (query[j].first <= B[i].second && B[i].second < query[j].second) {
        int nl = max(l, query[j].first), nr = min(r, query[j].second);
        ans[j] +=
            (long long)(B[i].second - nl + 1) * (nr - B[i].second) * B[i].first;
      }
  }
  for (int i = (0); i < (Q); i++) {
    printf("%lld\n", ans[i]);
  }
  return 0;
}
