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>
int a[100001], p[100001], N, Q;
int T[2100001], ls[2100001], rs[2100001], n, root[100001];
int end[100001], steps[100001];
int build(int l, int r) {
  int p = ++n;
  T[p] = r - l + 1;
  if (l < r) {
    int m = l + r >> 1;
    ls[p] = build(l, m);
    rs[p] = build(m + 1, r);
  }
  return p;
}
int get_kth(int p, int x) {
  int l = 1, r = N;
  while (l < r) {
    int m = l + r >> 1;
    if (x <= T[ls[p]])
      p = ls[p], r = m;
    else
      x -= T[ls[p]], p = rs[p], l = m + 1;
  }
  return l;
}
int P(int p, int x, int w) {
  int l = 1, r = N, root;
  T[root = ++n] = T[p] + w;
  while (l < r) {
    int m = l + r >> 1;
    if (x <= m)
      ls[n] = n + 1, rs[n] = rs[p], p = ls[p], r = m;
    else
      rs[n] = n + 1, ls[n] = ls[p], p = rs[p], l = m + 1;
    T[++n] = T[p] + w;
  }
  return root;
}
int G(int p, int x) {
  int l = 1, r = N, ans = 0;
  while (l < r) {
    int m = l + r >> 1;
    if (x <= m)
      p = ls[p], r = m;
    else
      ans += T[ls[p]], p = rs[p], l = m + 1;
  }
  return ans + T[p];
}
int main() {
  scanf("%d%d", &N, &Q);
  for (int i = 1; i <= N; i++) scanf("%d", a + i);
  end[0] = a[1] - 1;
  steps[0] = 0;
  for (int i = 1; i < N; i++) {
    int add = (a[i + 1] - end[i - 1] - 1) / i;
    end[i] = end[i - 1] + i * add;
    steps[i] = steps[i - 1] + add;
  }
  for (int i = 2; i <= N; i++) p[i] = (p[i - 1] + a[i] - a[i - 1]) % (i - 1);
  root[N] = build(1, N);
  for (int i = N; i; i--) {
    p[i] = get_kth(root[i], p[i] + 1);
    root[i - 1] = P(root[i], p[i], -1);
  }
  while (Q--) {
    int x, k;
    scanf("%d%d", &x, &k);
    if (x < a[1]) {
      printf("%d\n", x);
      continue;
    }
    int belong = std::lower_bound(end + 1, end + N, x) - end;
    k += steps[belong - 1] + (x - end[belong - 1] - 1) / belong + 1;
    int ord = (x - end[belong - 1] - 1) % belong + 1;
    ord = get_kth(root[belong], ord);
    belong = std::lower_bound(steps + 1, steps + N, k) - steps;
    printf("%lld\n", end[belong - 1] +
                         (long long)(k - steps[belong - 1] - 1) * belong +
                         G(root[belong], ord));
  }
  return 0;
}