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;
int n, q;
long long a[100002];
struct magic {
  long long st, len;
  long long rnd, des;
  bool operator<(const magic& b) const { return st < b.st; }
};
vector<magic> cool[262144];
void build(int id, int l, int r) {
  if (l == r) {
    long long num = (a[l + 1] - a[l]) / l, num2 = (a[l + 1] - a[l]) % l;
    if (num2 == 0) {
      magic tmp = {a[l], l, num, a[l + 1]};
      cool[id].push_back(tmp);
    } else {
      magic tmp = {a[l], num2, num + 1, (num + 1) * l + a[l]};
      cool[id].push_back(tmp);
      tmp = {a[l] + num2, l - num2, num, a[l + 1]};
      cool[id].push_back(tmp);
    }
    return;
  }
  int mid = (l + r) / 2;
  build(id * 2, l, mid);
  build(id * 2 + 1, mid + 1, r);
  for (magic cur : cool[id * 2]) {
    magic tmp = {cur.des + 1, 0, 0, 0};
    int pos =
        lower_bound(cool[id * 2 + 1].begin(), cool[id * 2 + 1].end(), tmp) -
        cool[id * 2 + 1].begin() - 1;
    long long did = 0;
    while (true) {
      magic lol = cool[id * 2 + 1][pos];
      if (lol.st < cur.des + did) {
        long long tmp = cur.des + did - lol.st;
        lol.st += tmp;
        lol.len -= tmp;
        lol.des += tmp;
      }
      if (did + lol.len > cur.len) {
        long long tmp = did + lol.len - cur.len;
        lol.len -= tmp;
      }
      magic newi = {cur.st + did, lol.len, cur.rnd + lol.rnd, lol.des};
      cool[id].push_back(newi);
      did += lol.len;
      pos++;
      if (did == cur.len) break;
    }
  }
}
long long x, k;
int pos;
bool solve(int id, int l, int r) {
  if (pos == l) {
    magic tmp = {x + 1, 0, 0, 0};
    int pos2 = lower_bound(cool[id].begin(), cool[id].end(), tmp) -
               cool[id].begin() - 1;
    if (k >= cool[id][pos2].rnd) {
      k -= cool[id][pos2].rnd;
      x = cool[id][pos2].des + x - cool[id][pos2].st;
      pos = r + 1;
      return false;
    }
  }
  if (l == r) return true;
  int mid = (l + r) / 2;
  if (pos > mid) {
    return solve(id * 2 + 1, mid + 1, r);
  }
  if (solve(id * 2, l, mid)) return true;
  return solve(id * 2 + 1, mid + 1, r);
}
int main() {
  ios::sync_with_stdio(false);
  cin >> n >> q;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    a[i] = a[i] - i + 1;
  }
  a[n + 1] = 1e18;
  build(1, 1, n);
  for (int i = 1; i <= q; i++) {
    cin >> x >> k;
    if (x < a[1]) {
      cout << x << '\n';
      continue;
    }
    pos = lower_bound(a + 1, a + n + 1, x + 1) - a - 1;
    long long num = (a[pos + 1] - x + pos - 1) / pos;
    if (num > k) {
      cout << x + k * pos << '\n';
      continue;
    }
    k -= num;
    x += num * pos;
    pos++;
    solve(1, 1, n);
    x += k * pos;
    cout << x << '\n';
  }
}