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;
const int mxN = 1e5;
int n, m;
long long a[mxN + 1];
vector<array<long long, 3>> st[1 << 18];
void bld(int i = 1, int l = 1, int r = n) {
  if (l == r) {
    st[i] = {{0, (a[l] - a[l - 1] + l - 1) / l}};
    st[i][0][2] = st[i][0][1] * l;
    if ((a[l] - a[l - 1]) % l) {
      st[i].push_back({(a[l] - a[l - 1]) % l, (a[l] - a[l - 1]) / l});
      st[i][1][2] = st[i][1][1] * l;
    }
    st[i].push_back({l});
    return;
  }
  int m = (l + r) / 2;
  bld(2 * i, l, m);
  bld(2 * i + 1, m + 1, r);
  for (int j = 0; j < st[2 * i].size() - 1; ++j) {
    long long lj = a[l - 1] + st[2 * i][j][0] + st[2 * i][j][2],
              rj = a[l - 1] + st[2 * i][j + 1][0] + st[2 * i][j][2];
    int k = lower_bound(st[2 * i + 1].begin(), st[2 * i + 1].end(),
                        array<long long, 3>{lj - a[m] + 1}) -
            st[2 * i + 1].begin() - 1;
    for (; a[m] + st[2 * i + 1][k][0] < rj; ++k)
      st[i].push_back(
          {st[2 * i][j][0] + max(a[m] + st[2 * i + 1][k][0] - lj, 0ll),
           st[2 * i][j][1] + st[2 * i + 1][k][1],
           st[2 * i][j][2] + st[2 * i + 1][k][2]});
  }
  st[i].push_back({l});
}
void qry(int l1, long long &x, long long &k, int i = 1, int l2 = 1,
         int r2 = n) {
  if (!k || r2 < l1) return;
  int j = lower_bound(st[i].begin(), st[i].end(),
                      array<long long, 3>{x - a[l2 - 1] + 1}) -
          st[i].begin() - 1;
  if (l1 <= l2 && k >= st[i][j][1]) {
    k -= st[i][j][1];
    x += st[i][j][2];
    return;
  }
  if (l2 == r2) {
    x += k * l2;
    k = 0;
  } else {
    int m2 = (l2 + r2) / 2;
    qry(l1, x, k, 2 * i, l2, m2);
    qry(l1, x, k, 2 * i + 1, m2 + 1, r2);
  }
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> m;
  for (int i = 0; i < n; ++i) cin >> a[i], a[i] -= i;
  a[n] = 1e15;
  bld();
  for (long long x, k; m--;) {
    cin >> x >> k;
    int i = upper_bound(a, a + n, x) - a;
    if (i) {
      k += (x - a[i - 1]) / i;
      x -= (x - a[i - 1]) / i * i;
      qry(i, x, k);
    }
    cout << x << "\n";
  }
}