Problem: There is a strip with an infinite number of cells. Cells are numbered starting with 0. Initially the cell i contains a ball with the number i.

There are n pockets located at cells a_1, …, a_n. Each cell contains at most one pocket.

Filtering is the following sequence of operations:

  * All pockets at cells a_1, …, a_n open simultaneously, which makes balls currently located at those cells disappear. After the balls disappear, the pockets close again.
  * For each cell i from 0 to ∞, if the cell i contains a ball, we move that ball to the free cell j with the lowest number. If there is no free cell j < i, the ball stays at the cell i.



Note that after each filtering operation each cell will still contain exactly one ball.

For example, let the cells 1, 3 and 4 contain pockets. The initial configuration of balls is shown below (underscores display the cells with pockets):

0 1 2 3 4 5 6 7 8 9 ... 

After opening and closing the pockets, balls 1, 3 and 4 disappear:

0  2  5 6 7 8 9 ... 

After moving all the balls to the left, the configuration looks like this:

0 2 5 6 7 8 9 10 11 12 ... 

Another filtering repetition results in the following:

0 5 8 9 10 11 12 13 14 15 ... 

You have to answer m questions. The i-th of these questions is "what is the number of the ball located at the cell x_i after k_i repetitions of the filtering operation?"

Input

The first line contains two integers n and m — the number of pockets and questions respectively (1 ≤ n, m ≤ 10^5).

The following line contains n integers a_1, …, a_n — the numbers of cells containing pockets (0 ≤ a_1 < … < a_n ≤ 10^9).

The following m lines describe questions. The i-th of these lines contains two integers x_i and k_i (0 ≤ x_i, k_i ≤ 10^9).

Output

Print m numbers — answers to the questions, in the same order as given in the input.

Example

Input

3 15
1 3 4
0 0
1 0
2 0
3 0
4 0
0 1
1 1
2 1
3 1
4 1
0 2
1 2
2 2
3 2
4 2


Output

0
1
2
3
4
0
2
5
6
7
0
5
8
9
10

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
long long a[100010], lc[100010 * 100], rc[100010 * 100], ct, s[100010 * 100], n,
    m, p[100010], s1[100010], rt[100010], s2[100010], va[100010], po[100010],
    bt[100010], sp;
void add(long long x, long long v) {
  for (; x <= n; x += x & -x) bt[x] += v;
}
long long q(long long x) {
  long long r = 0;
  for (; x; x -= x & -x) r += bt[x];
  return r;
}
long long gk(long long x) {
  long long l = 0, r;
  for (long long i = 31 - __builtin_clz(n); ~i; i--) {
    r = l + (1 << i);
    if (r <= n && bt[r] < x) {
      l = r;
      x -= bt[r];
    }
  }
  l++;
  return l;
}
void add(long long &o, long long p, long long l, long long r, long long x,
         long long y) {
  if (!o) o = ++ct;
  s[o] = s[p] + 1;
  if (l == r) return;
  long long md = (l + r) / 2;
  if (x <= md) {
    add(lc[o], lc[p], l, md, x, y);
    rc[o] = rc[p];
  } else {
    add(rc[o], rc[p], md + 1, r, x, y);
    lc[o] = lc[p];
  }
}
long long qu(long long o, long long l, long long r, long long x, long long y) {
  if (r < x || y < l || !o) return 0;
  if (x <= l && r <= y) return s[o];
  long long md = (l + r) / 2;
  return qu(lc[o], l, md, x, y) + qu(rc[o], md + 1, r, x, y);
}
long long qk(long long o, long long l, long long r, long long k) {
  while (l != r) {
    long long md = (l + r) / 2;
    if (k <= s[lc[o]]) {
      o = lc[o];
      r = md;
    } else {
      k -= s[lc[o]];
      o = rc[o];
      l = md + 1;
    }
  }
  return l;
}
void gv(long long k, long long &x, long long &y) {
  if (k < 0)
    x = y = 0;
  else {
    x = upper_bound(s1, s1 + n, k) - s1;
    y = (k + 1) * x - s2[x] - 1;
  }
}
signed main() {
  cin >> n >> m >> sp;
  for (long long i = 1; i < n; i++) {
    cin >> a[i];
    a[i] -= sp;
  }
  for (long long i = 1; i < n; i++) {
    long long v = (a[i] - va[i - 1]) / i;
    s1[i] = s1[i - 1] + v;
    va[i] = va[i - 1] + v * i;
    s2[i + 1] = s2[i] + s1[i];
  }
  for (long long i = 1; i <= n; i++) bt[i] = i & -i;
  for (long long i = n - 1; ~i; i--) {
    po[i] = gk(a[i] - va[i] + 1);
    add(po[i], -1);
  }
  for (long long i = 0; i < n; i++) add(rt[i + 1], rt[i], 1, n, po[i], 1);
  while (m--) {
    long long x, y, c, d, pa, pb;
    cin >> x >> y;
    if (x < sp) {
      cout << x << '\n';
      continue;
    }
    x -= sp;
    long long l = 0, r = x;
    while (l < r) {
      long long md = (l + r) / 2;
      gv(md, c, d);
      if (x <= d)
        r = md;
      else
        l = md + 1;
    }
    gv(l, c, d);
    pa = x - d + c;
    pb = qk(rt[c], 1, n, pa);
    l += y;
    gv(l, c, d);
    pa = qu(rt[c], 1, n, 1, pb);
    x = d - c + pa;
    cout << x + sp << '\n';
  }
}