#include <bits/stdc++.h>
using namespace std;
using namespace std::chrono;
const long double EPS = 1e-8;
const long double PI = acos(-1.0);
const int MAXN = 2e5;
pair<int, int> X[MAXN];
int pos[MAXN];
void run() {
  int n, m, i, j, k, l;
  scanf("%d%d", &n, &m);
  for (i = 0; i < n; ++i) {
    scanf("%d", &l);
    X[i] = pair<int, int>(l, i);
  }
  sort(X, X + n);
  for (i = 0; i < n; ++i) pos[X[i].second] = i;
  for (k = 0; k < m; ++k) {
    scanf("%d%d", &i, &l);
    i = pos[i - 1];
    for (j = 0;; j = !j) {
      if ((i == n - 1 || l < X[i + 1].first - X[i].first) &&
          (i == 0 || l < X[i].first - X[i - 1].first))
        break;
      if (j == 0) {
        int ni =
            upper_bound(X, X + n, pair<int, int>(X[i].first + l, MAXN + 1)) -
            X - 1;
        l -= X[ni].first - X[i].first;
        i = ni;
      } else {
        int ni = lower_bound(X, X + n, pair<int, int>(X[i].first - l, -1)) - X;
        l -= X[i].first - X[ni].first;
        if (i != ni) l %= 2 * (X[i].first - X[ni].first);
        i = ni;
      }
    }
    printf("%d\n", X[i].second + 1);
  }
}
int main() {
  run();
  return 0;
}

### Prompt

Create a solution in cpp for the following problem:

Andrewid the Android is a galaxy-famous detective. Now he is busy with a top secret case, the details of which are not subject to disclosure.

However, he needs help conducting one of the investigative experiment. There are n pegs put on a plane, they are numbered from 1 to n, the coordinates of the i-th of them are (xi, 0). Then, we tie to the bottom of one of the pegs a weight on a tight rope of length l (thus, its coordinates will be equal to (xi, - l), where i is the number of the used peg). Then the weight is pushed to the right, so that it starts to rotate counterclockwise. At the same time, if the weight during rotation touches some of the other pegs, it then begins to rotate around that peg. Suppose that each peg itself is very thin and does not affect the rope length while weight is rotating around it.

<image>

More formally, if at some moment the segment of the rope contains one or more pegs in addition to the peg around which the weight is rotating, the weight will then rotate around the farthermost one of them on a shorter segment of a rope. In particular, if the segment of the rope touches some peg by its endpoint, it is considered that the weight starts to rotate around that peg on a segment of the rope of length 0.

At some moment the weight will begin to rotate around some peg, without affecting the rest of the pegs. Andrewid interested in determining the number of this peg.

Andrewid prepared m queries containing initial conditions for pushing the weight, help him to determine for each of them, around what peg the weight will eventually rotate.

Input

The first line contains integers n and m (1 ≤ n, m ≤ 2·105) — the number of pegs and queries.

The next line contains n integers x1, x2, ..., xn ( - 109 ≤ xi ≤ 109) — the coordinates of the pegs. It is guaranteed that the coordinates of all the pegs are distinct integers.

Next m lines contain the descriptions of the queries of pushing the weight, each consists of two integers ai (1 ≤ ai ≤ n) and li (1 ≤ li ≤ 109) — the number of the starting peg and the length of the rope.

Output

Print m lines, the i-th line should contain the number of the peg around which the weight will eventually rotate after the i-th push.

Examples

Input

3 2
0 3 5
2 3
1 8


Output

3
2


Input

4 4
1 5 7 15
1 4
2 15
3 16
1 28


Output

2
4
3
1

Note

Picture to the first sample test:

<image>

Picture to the second sample test:

<image>

Note that in the last query weight starts to rotate around the peg 1 attached to a rope segment of length 0.

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
using namespace std::chrono;
const long double EPS = 1e-8;
const long double PI = acos(-1.0);
const int MAXN = 2e5;
pair<int, int> X[MAXN];
int pos[MAXN];
void run() {
  int n, m, i, j, k, l;
  scanf("%d%d", &n, &m);
  for (i = 0; i < n; ++i) {
    scanf("%d", &l);
    X[i] = pair<int, int>(l, i);
  }
  sort(X, X + n);
  for (i = 0; i < n; ++i) pos[X[i].second] = i;
  for (k = 0; k < m; ++k) {
    scanf("%d%d", &i, &l);
    i = pos[i - 1];
    for (j = 0;; j = !j) {
      if ((i == n - 1 || l < X[i + 1].first - X[i].first) &&
          (i == 0 || l < X[i].first - X[i - 1].first))
        break;
      if (j == 0) {
        int ni =
            upper_bound(X, X + n, pair<int, int>(X[i].first + l, MAXN + 1)) -
            X - 1;
        l -= X[ni].first - X[i].first;
        i = ni;
      } else {
        int ni = lower_bound(X, X + n, pair<int, int>(X[i].first - l, -1)) - X;
        l -= X[i].first - X[ni].first;
        if (i != ni) l %= 2 * (X[i].first - X[ni].first);
        i = ni;
      }
    }
    printf("%d\n", X[i].second + 1);
  }
}
int main() {
  run();
  return 0;
}

```