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 long long N = 1e5 + 3;
const long long inf = 1e15 + 3;
vector<array<long long, 3> > it[4 * N];
long long ar[N], x, s;
void build(long long idx, long long l, long long r) {
  if (l == r) {
    it[idx].push_back({0, (ar[l] - ar[l - 1] + l - 1) / l,
                       (ar[l] - ar[l - 1] + l - 1) / l * l});
    if ((ar[l] - ar[l - 1]) % l) {
      it[idx].push_back({(ar[l] - ar[l - 1]) % l, (ar[l] - ar[l - 1]) / l,
                         (ar[l] - ar[l - 1]) / l * l});
    }
    it[idx].push_back({l});
    return;
  }
  long long mid = (l + r) / 2;
  build(2 * idx, l, mid);
  build(2 * idx + 1, mid + 1, r);
  for (long long i = 0; i + 1 < it[2 * idx].size(); i++) {
    long long lef = ar[l - 1] + it[2 * idx][i][0] + it[2 * idx][i][2] - ar[mid],
              rig = ar[l - 1] + it[2 * idx][i + 1][0] + it[2 * idx][i][2] -
                    ar[mid];
    long long j = upper_bound(it[2 * idx + 1].begin(), it[2 * idx + 1].end(),
                              array<long long, 3>{lef, inf + 1, inf + 1}) -
                  it[2 * idx + 1].begin() - 1;
    for (; j + 1 < it[2 * idx + 1].size(); j++) {
      if (it[2 * idx + 1][j][0] >= rig) {
        break;
      }
      it[idx].push_back(
          {it[2 * idx][i][0] + max(0ll, it[2 * idx + 1][j][0] - lef),
           it[2 * idx][i][1] + it[2 * idx + 1][j][1],
           it[2 * idx][i][2] + it[2 * idx + 1][j][2]});
    }
  }
  it[idx].push_back({l});
}
void query(long long idx, long long l, long long r, long long pos) {
  if (r < pos || x < ar[l - 1]) {
    return;
  }
  long long j =
      upper_bound(it[idx].begin(), it[idx].end(),
                  array<long long, 3>{x - ar[l - 1], inf + 1, inf + 1}) -
      it[idx].begin() - 1;
  if (l >= pos && s >= it[idx][j][1]) {
    assert(j >= 0 && j < it[idx].size());
    s -= it[idx][j][1];
    x += it[idx][j][2];
    return;
  }
  if (l == r) {
    x += s * l;
    s = 0;
    return;
  }
  query(2 * idx, l, (l + r) / 2, pos);
  query(2 * idx + 1, (l + r) / 2 + 1, r, pos);
}
signed main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  long long n, m, i, j, k, l, q;
  cin >> n >> q;
  for (i = 0; i < n; i++) {
    cin >> ar[i];
    ar[i] -= i;
  }
  ar[n] = inf;
  build(1, 1, n);
  for (i = 1; i <= q; i++) {
    cin >> x >> s;
    l = upper_bound(ar, ar + n, x) - ar;
    if (l) {
      s += (x - ar[l - 1]) / l;
      x -= (x - ar[l - 1]) / l * l;
      query(1, 1, n, l);
    }
    cout << x << '\n';
  }
}