#include <bits/stdc++.h>
using namespace std;
#define m_p make_pair
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define fi first
#define se second
typedef long long ll;
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
mt19937 rnf(2100);
const int N = 200005;

int n;
int a[N];
pair<int, int> b[N];

void solv()
{
    int qq;
    scanf("%d%d", &n, &qq);
    for (int i = 1; i <= n; ++i)
    {
        scanf("%d", &a[i]);
        b[i] = m_p(a[i], i);
    }
    sort(a + 1, a + n + 1);
    sort(b + 1, b + n + 1);
    while (qq--)
    {
        int x, d;
        scanf("%d%d", &x, &d);
        bool z = false;

        int y = upper_bound(a + 1, a + n + 1, a[x] + d) - a - 1;

        if (x == y)
        {
            printf("%d\n", b[x].se);
            continue;
        }

        d -= abs(a[x] - a[y]);
        x = y;
        z ^= true;

        if (x == n)
        {
            int q = d / (a[n] - a[1]);
            d %= (a[n] - a[1]);
            if (q % 2 == 1)
            {
                x = 1;
                z ^= true;
            }
        }

        while (1)
        {
            if (!z)
            {
                y = upper_bound(a + 1, a + n + 1, a[x] + d) - a - 1;

                if (x == y)
                {
                    printf("%d\n", b[x].se);
                    break;
                }

                d -= abs(a[x] - a[y]);
                x = y;
                z ^= true;
            }
            else
            {
                int y = lower_bound(a + 1, a + n + 1, a[x] - d) - a;

                if (x == y)
                {
                    printf("%d\n", b[x].se);
                    break;
                }

                d -= abs(a[x] - a[y]);
                x = y;
                z ^= true;
            }
        }
    }
}

int main()
{
    #ifdef SOMETHING
    freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    #endif // SOMETHING
    //ios_base::sync_with_stdio(false), cin.tie(0);
    solv();
    return 0;
}

//while ((double)clock() / CLOCKS_PER_SEC <= 0.9){}


#include <bits/stdc++.h>
using namespace std;
#define m_p make_pair
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define fi first
#define se second
typedef long long ll;
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
mt19937 rnf(2100);
const int N = 200005;

int n;
int a[N];
pair<int, int> b[N];
int u[N];

void solv()
{
    int qq;
    scanf("%d%d", &n, &qq);
    for (int i = 1; i <= n; ++i)
    {
        scanf("%d", &a[i]);
        b[i] = m_p(a[i], i);
    }
    sort(a + 1, a + n + 1);
    sort(b + 1, b + n + 1);
    for (int i = 1; i <= n; ++i)
        u[b[i].se] = i;

    while (qq--)
    {
        int x, d;
        scanf("%d%d", &x, &d);
        x = u[x];
        bool z = false;

        if (n == 1)
        {
            printf("1\n");
            continue;
        }

        while (1)
        {
            if (x == n)
            {
                int q = d / (a[n] - a[1]);
                d %= (a[n] - a[1]);
                if (q % 2 == 1)
                    x = 1;
            }
            /*if (x == 1)
            {
                int q = d / (a[n] - a[1]);
                d %= (a[n] - a[1]);
                if (q % 2 == 1)
                    x = n;
            }*/

            if (x == n && !z)
            {
                z ^= true;
            }
            if (x == 1 && z)
            {
                z ^= true;
            }

            if (!z)
            {
                int y = upper_bound(a + 1, a + n + 1, a[x] + d) - a - 1;

                if (x == y)
                {
                    printf("%d\n", b[x].se);
                    break;
                }

                d -= abs(a[x] - a[y]);
                x = y;
                z ^= true;
            }
            else
            {
                int y = lower_bound(a + 1, a + n + 1, a[x] - d) - a;

                if (x == y)
                {
                    printf("%d\n", b[x].se);
                    break;
                }

                d -= abs(a[x] - a[y]);
                x = y;
                z ^= true;
            }
            assert(1 <= x && x <= n);
        }
    }
}

int main()
{
    #ifdef SOMETHING
    freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    #endif // SOMETHING
    //ios_base::sync_with_stdio(false), cin.tie(0);
    solv();
    return 0;
}

//while ((double)clock() / CLOCKS_PER_SEC <= 0.9){}


#include <bits/stdc++.h>
using namespace std;
#define m_p make_pair
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define fi first
#define se second
typedef long long ll;
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
mt19937 rnf(2100);
const int N = 200005;

int n;
int a[N];
pair<int, int> b[N];
int u[N];

void solv()
{
    int qq;
    scanf("%d%d", &n, &qq);
    for (int i = 1; i <= n; ++i)
    {
        scanf("%d", &a[i]);
        b[i] = m_p(a[i], i);
    }
    sort(a + 1, a + n + 1);
    sort(b + 1, b + n + 1);
    for (int i = 1; i <= n; ++i)
        u[b[i].se] = i;

    while (qq--)
    {
        int x, d;
        scanf("%d%d", &x, &d);
        x = u[x];
        bool z = false;

        if (n == 1)
        {
            printf("1\n");
            continue;
        }

        int qq = 0;

        while (1)
        {
            if (!z)
            {
                int y;
                if (x < n && a[x] + d >= a[x + 1])
                    y = upper_bound(a + 1, a + n + 1, a[x] + d) - a - 1;
                else
                    y = lower_bound(a + 1, a + n + 1, a[x] - d) - a;

                if (x == y)
                    break;

                int q = (d / abs(a[x] - a[y]));
                d %= abs(a[x] - a[y]);

                if (q % 2 == 1)
                {
                    x = y;
                }
            }
            else
            {
                int y;
                if (x > 1 && a[x] - d <= a[x - 1])
                    y = lower_bound(a + 1, a + n + 1, a[x] - d) - a;
                else
                    y = upper_bound(a + 1, a + n + 1, a[x] + d) - a - 1;

                if (x == y)
                    break;

                int q = (d / abs(a[x] - a[y]));
                d %= abs(a[x] - a[y]);
                if (q % 2 == 1)
                {
                    x = y;
                }
            }
            assert(1 <= x && x <= n);
        }
        printf("%d\n", b[x].se);
    }
}

int main()
{
    #ifdef SOMETHING
    freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    #endif // SOMETHING
    //ios_base::sync_with_stdio(false), cin.tie(0);
    solv();
    return 0;
}

//while ((double)clock() / CLOCKS_PER_SEC <= 0.9){}


#include <bits/stdc++.h>
using namespace std;
#define m_p make_pair
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define fi first
#define se second
typedef long long ll;
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
mt19937 rnf(2100);
const int N = 200005;

int n;
int a[N];
pair<int, int> b[N];
int u[N];

void solv()
{
    int qq;
    scanf("%d%d", &n, &qq);
    for (int i = 1; i <= n; ++i)
    {
        scanf("%d", &a[i]);
        b[i] = m_p(a[i], i);
    }
    sort(a + 1, a + n + 1);
    sort(b + 1, b + n + 1);
    for (int i = 1; i <= n; ++i)
        u[b[i].se] = i;

    while (qq--)
    {
        int x, d;
        scanf("%d%d", &x, &d);
        x = u[x];
        bool z = false;

        if (n == 1)
        {
            printf("1\n");
            continue;
        }

        while (1)
        {
            if (x == n)
            {
                int q = d / (a[n] - a[1]);
                d %= (a[n] - a[1]);
                if (q % 2 == 1)
                    x = 1;
            }
            if (x == 1)
            {
                int q = d / (a[n] - a[1]);
                d %= (a[n] - a[1]);
                if (q % 2 == 0)
                    x = n;
            }

            if (x == n && !z)
            {
                z ^= true;
                continue;
            }
            if (x == 1 && z)
            {
                z ^= true;
                continue;
            }

            if (!z)
            {
                int y = upper_bound(a + 1, a + n + 1, a[x] + d) - a - 1;

                if (x == y)
                {
                    printf("%d\n", b[x].se);
                    break;
                }

                d -= abs(a[x] - a[y]);
                x = y;
                z ^= true;
            }
            else
            {
                int y = lower_bound(a + 1, a + n + 1, a[x] - d) - a;

                if (x == y)
                {
                    printf("%d\n", b[x].se);
                    break;
                }

                d -= abs(a[x] - a[y]);
                x = y;
                z ^= true;
            }
            assert(1 <= x && x <= n);
        }
    }
}

int main()
{
    #ifdef SOMETHING
    freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    #endif // SOMETHING
    //ios_base::sync_with_stdio(false), cin.tie(0);
    solv();
    return 0;
}

//while ((double)clock() / CLOCKS_PER_SEC <= 0.9){}


#include <bits/stdc++.h>
using namespace std;
#define m_p make_pair
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define fi first
#define se second
typedef long long ll;
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
mt19937 rnf(2100);
const int N = 200005;

int n;
int a[N];
pair<int, int> b[N];
int u[N];

void solv()
{
    int qq;
    scanf("%d%d", &n, &qq);
    for (int i = 1; i <= n; ++i)
    {
        scanf("%d", &a[i]);
        b[i] = m_p(a[i], i);
    }
    sort(a + 1, a + n + 1);
    sort(b + 1, b + n + 1);
    for (int i = 1; i <= n; ++i)
        u[b[i].se] = i;

    while (qq--)
    {
        int x, d;
        scanf("%d%d", &x, &d);
        x = u[x];
        bool z = false;

        if (n == 1)
        {
            printf("1\n");
            continue;
        }

        while (1)
        {
            if (x == n)
            {
                int q = d / (a[n] - a[1]);
                d %= (a[n] - a[1]);
                if (q % 2 == 1)
                    x = 1;
            }
            if (x == 1)
            {
                int q = d / (a[n] - a[1]);
                d %= (a[n] - a[1]);
                if (q % 2 == 1)
                    x = n;
            }

            if (x == n && !z)
            {
                z ^= true;
            }
            if (x == 1 && z)
            {
                z ^= true;
            }

            if (!z)
            {
                int y = upper_bound(a + 1, a + n + 1, a[x] + d) - a - 1;

                if (x == y)
                {
                    printf("%d\n", b[x].se);
                    break;
                }

                d -= abs(a[x] - a[y]);
                x = y;
                z ^= true;
            }
            else
            {
                int y = lower_bound(a + 1, a + n + 1, a[x] - d) - a;

                if (x == y)
                {
                    printf("%d\n", b[x].se);
                    break;
                }

                d -= abs(a[x] - a[y]);
                x = y;
                z ^= true;
            }
            assert(1 <= x && x <= n);
        }
    }
}

int main()
{
    #ifdef SOMETHING
    freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    #endif // SOMETHING
    //ios_base::sync_with_stdio(false), cin.tie(0);
    solv();
    return 0;
}

//while ((double)clock() / CLOCKS_PER_SEC <= 0.9){}


#include <bits/stdc++.h>
using namespace std;
#define m_p make_pair
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define fi first
#define se second
typedef long long ll;
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
mt19937 rnf(2100);
const int N = 200005;

int n;
int a[N];
pair<int, int> b[N];
int u[N];

void solv()
{
    int qq;
    scanf("%d%d", &n, &qq);
    for (int i = 1; i <= n; ++i)
    {
        scanf("%d", &a[i]);
        b[i] = m_p(a[i], i);
    }
    sort(a + 1, a + n + 1);
    sort(b + 1, b + n + 1);
    for (int i = 1; i <= n; ++i)
        u[b[i].se] = i;

    while (qq--)
    {
        int x, d;
        scanf("%d%d", &x, &d);
        x = u[x];
        bool z = false;

        if (n == 1)
        {
            printf("1\n");
            continue;
        }

        int qq = 0;

        while (1)
        {
            if (!z)
            {
                int y;
                if (x < n && a[x] + d >= a[x + 1])
                    y = upper_bound(a + 1, a + n + 1, a[x] + d) - a - 1;
                else
                    y = lower_bound(a + 1, a + n + 1, a[x] - d) - a;

                if (x == y)
                    break;

                int q = (d / abs(a[x] - a[y]));
                d %= abs(a[x] - a[y]);

                if (q % 2 == 1)
                {
                    x = y;
                    z ^= true;
                }
            }
            else
            {
                int y;
                if (x > 1 && a[x] - d <= a[x - 1])
                    y = lower_bound(a + 1, a + n + 1, a[x] - d) - a;
                else
                    y = upper_bound(a + 1, a + n + 1, a[x] + d) - a - 1;

                if (x == y)
                    break;

                int q = (d / abs(a[x] - a[y]));
                d %= abs(a[x] - a[y]);
                if (q % 2 == 1)
                {
                    x = y;
                    z ^= true;
                }
            }
            assert(1 <= x && x <= n);
        }
        printf("%d\n", b[x].se);
    }
}

int main()
{
    #ifdef SOMETHING
    freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    #endif // SOMETHING
    //ios_base::sync_with_stdio(false), cin.tie(0);
    solv();
    return 0;
}

//while ((double)clock() / CLOCKS_PER_SEC <= 0.9){}


#include <bits/stdc++.h>
using namespace std;
#define m_p make_pair
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define fi first
#define se second
typedef long long ll;
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
mt19937 rnf(2100);
const int N = 200005;

int n;
int a[N];
pair<int, int> b[N];
int u[N];

void solv()
{
    int qq;
    scanf("%d%d", &n, &qq);
    for (int i = 1; i <= n; ++i)
    {
        scanf("%d", &a[i]);
        b[i] = m_p(a[i], i);
    }
    sort(a + 1, a + n + 1);
    sort(b + 1, b + n + 1);
    for (int i = 1; i <= n; ++i)
        u[b[i].se] = i;

    while (qq--)
    {
        int x, d;
        scanf("%d%d", &x, &d);
        x = u[x];
        bool z = false;

        if (n == 1)
        {
            printf("1\n");
            continue;
        }

        while (1)
        {
            if (x == n)
            {
                int q = d / (a[n] - a[1]);
                d %= (a[n] - a[1]);
                if (q % 2 == 1)
                    x = 1;
            }
            if (x == 1)
            {
                int q = d / (a[n] - a[1]);
                d %= (a[n] - a[1]);
                if (q % 2 == 1)
                    x = n;
            }

            if (!z)
            {
                int y;
                if (x < n)
                    y = upper_bound(a + 1, a + n + 1, a[x] + d) - a - 1;
                else
                    y = lower_bound(a + 1, a + n + 1, a[x] - d) - a;

                if (x == y)
                {
                    printf("%d\n", b[x].se);
                    break;
                }

                d -= abs(a[x] - a[y]);
                x = y;
                z ^= true;
            }
            else
            {
                int y;
                if (x > 1)
                    y = lower_bound(a + 1, a + n + 1, a[x] - d) - a;
                else
                    y = upper_bound(a + 1, a + n + 1, a[x] + d) - a - 1;

                if (x == y)
                {
                    printf("%d\n", b[x].se);
                    break;
                }

                d -= abs(a[x] - a[y]);
                x = y;
                z ^= true;
            }
            assert(1 <= x && x <= n);
        }
    }
}

int main()
{
    #ifdef SOMETHING
    freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    #endif // SOMETHING
    //ios_base::sync_with_stdio(false), cin.tie(0);
    solv();
    return 0;
}

//while ((double)clock() / CLOCKS_PER_SEC <= 0.9){}


#include <bits/stdc++.h>
using namespace std;
#define m_p make_pair
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define fi first
#define se second
typedef long long ll;
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
mt19937 rnf(2100);
const int N = 200005;

int n;
int a[N];
pair<int, int> b[N];
int u[N];

void solv()
{
    int qq;
    scanf("%d%d", &n, &qq);
    for (int i = 1; i <= n; ++i)
    {
        scanf("%d", &a[i]);
        b[i] = m_p(a[i], i);
    }
    sort(a + 1, a + n + 1);
    sort(b + 1, b + n + 1);
    for (int i = 1; i <= n; ++i)
        u[b[i].se] = i;

    while (qq--)
    {
        int x, d;
        scanf("%d%d", &x, &d);
        x = u[x];
        bool z = false;

        int y = upper_bound(a + 1, a + n + 1, a[x] + d) - a - 1;

        if (x == y)
        {
            printf("%d\n", b[x].se);
            continue;
        }

        d -= abs(a[x] - a[y]);
        x = y;
        z ^= true;

        /*if (x == n)
        {
            int q = d / (a[n] - a[1]);
            d %= (a[n] - a[1]);
            if (q % 2 == 1)
            {
                x = 1;
                z ^= true;
            }
        }*/

        while (1)
        {
            if (!z)
            {
                int y = upper_bound(a + 1, a + n + 1, a[x] + d) - a - 1;

                if (x == y)
                {
                    printf("%d\n", b[x].se);
                    break;
                }

                d -= abs(a[x] - a[y]);
                x = y;
                z ^= true;
            }
            else
            {
                int y = lower_bound(a + 1, a + n + 1, a[x] - d) - a;

                if (x == y)
                {
                    printf("%d\n", b[x].se);
                    break;
                }

                d -= abs(a[x] - a[y]);
                x = y;
                z ^= true;
            }
            assert(1 <= x && x <= n);
        }
    }
}

int main()
{
    #ifdef SOMETHING
    freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    #endif // SOMETHING
    //ios_base::sync_with_stdio(false), cin.tie(0);
    solv();
    return 0;
}

//while ((double)clock() / CLOCKS_PER_SEC <= 0.9){}


#include <bits/stdc++.h>
using namespace std;
#define m_p make_pair
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define fi first
#define se second
typedef long long ll;
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
mt19937 rnf(2100);
const int N = 200005;

int n;
int a[N];
pair<int, int> b[N];
int u[N];

void solv()
{
    int qq;
    scanf("%d%d", &n, &qq);
    for (int i = 1; i <= n; ++i)
    {
        scanf("%d", &a[i]);
        b[i] = m_p(a[i], i);
    }
    sort(a + 1, a + n + 1);
    sort(b + 1, b + n + 1);
    for (int i = 1; i <= n; ++i)
        u[b[i].se] = i;

    while (qq--)
    {
        int x, d;
        scanf("%d%d", &x, &d);
        x = u[x];
        bool z = false;

        if (n == 1)
        {
            printf("1\n");
            continue;
        }

        int qq = 0;

        while (1)
        {
            if (!z)
            {
                if (!(x < n && a[x] + d >= a[x + 1]))
                    z ^= true;
            }
            else
            {
                if (!(x > 1 && a[x] - d <= a[x - 1]))
                    z ^= true;
            }
            if (!z)
            {
                int y;
                y = upper_bound(a + 1, a + n + 1, a[x] + d) - a - 1;

                if (x == y)
                    break;

                int q = (d / abs(a[x] - a[y]));
                d %= abs(a[x] - a[y]);

                if (q % 2 == 1)
                {
                    x = y;
                }
            }
            else
            {
                int y;
                y = lower_bound(a + 1, a + n + 1, a[x] - d) - a;

                if (x == y)
                    break;

                int q = (d / abs(a[x] - a[y]));
                d %= abs(a[x] - a[y]);
                if (q % 2 == 1)
                {
                    x = y;
                }
            }
            assert(1 <= x && x <= n);
        }
        printf("%d\n", b[x].se);
    }
}

int main()
{
    #ifdef SOMETHING
    freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    #endif // SOMETHING
    //ios_base::sync_with_stdio(false), cin.tie(0);
    solv();
    return 0;
}

//while ((double)clock() / CLOCKS_PER_SEC <= 0.9){}


#include <bits/stdc++.h>
using namespace std;
#define m_p make_pair
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define fi first
#define se second
typedef long long ll;
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
mt19937 rnf(2100);
const int N = 200005;

int n;
int a[N];
pair<int, int> b[N];
int u[N];

void solv()
{
    int qq;
    scanf("%d%d", &n, &qq);
    for (int i = 1; i <= n; ++i)
    {
        scanf("%d", &a[i]);
        b[i] = m_p(a[i], i);
    }
    sort(a + 1, a + n + 1);
    sort(b + 1, b + n + 1);
    for (int i = 1; i <= n; ++i)
        u[b[i].se] = i;

    while (qq--)
    {
        int x, d;
        scanf("%d%d", &x, &d);
        x = u[x];
        bool z = false;

        int y = upper_bound(a + 1, a + n + 1, a[x] + d) - a - 1;

        if (x == y)
        {
            printf("%d\n", b[x].se);
            continue;
        }

        d -= abs(a[x] - a[y]);
        x = y;
        z ^= true;

        /*if (x == n)
        {
            int q = d / (a[n] - a[1]);
            d %= (a[n] - a[1]);
            if (q % 2 == 1)
            {
                x = 1;
                z ^= true;
            }
        }*/

        while (1)
        {
            if (!z)
            {
                int y = upper_bound(a + 1, a + n + 1, a[x] + d) - a - 1;

                if (x == y)
                {
                    printf("%d\n", b[x].se);
                    break;
                }

                d -= abs(a[x] - a[y]);
                x = y;
                z ^= true;
            }
            else
            {
                int y = lower_bound(a + 1, a + n + 1, a[x] - d) - a;

                if (x == y)
                {
                    printf("%d\n", b[x].se);
                    break;
                }

                d -= abs(a[x] - a[y]);
                x = y;
                z ^= true;
            }
            assert(1 <= x && x <= n)
        }
    }
}

int main()
{
    #ifdef SOMETHING
    freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    #endif // SOMETHING
    //ios_base::sync_with_stdio(false), cin.tie(0);
    solv();
    return 0;
}

//while ((double)clock() / CLOCKS_PER_SEC <= 0.9){}


#include <bits/stdc++.h>
using namespace std;
#define m_p make_pair
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define fi first
#define se second
typedef long long ll;
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
mt19937 rnf(2100);
const int N = 200005;

int n;
int a[N];
pair<int, int> b[N];
int u[N];

void solv()
{
    int qq;
    scanf("%d%d", &n, &qq);
    for (int i = 1; i <= n; ++i)
    {
        scanf("%d", &a[i]);
        b[i] = m_p(a[i], i);
    }
    sort(a + 1, a + n + 1);
    sort(b + 1, b + n + 1);
    for (int i = 1; i <= n; ++i)
        u[b[i].se] = i;

    while (qq--)
    {
        int x, d;
        scanf("%d%d", &x, &d);
        x = u[x];
        bool z = false;

        /*int y = upper_bound(a + 1, a + n + 1, a[x] + d) - a - 1;

        if (x == y)
        {
            printf("%d\n", b[x].se);
            continue;
        }

        d -= abs(a[x] - a[y]);
        x = y;
        z ^= true;*/

        /*if (x == n)
        {
            int q = d / (a[n] - a[1]);
            d %= (a[n] - a[1]);
            if (q % 2 == 1)
            {
                x = 1;
                z ^= true;
            }
        }*/

        while (1)
        {
            if (x == n && !z)
            {
                z ^= true;
                continue;
            }
            if (x == 1 && z)
            {
                z ^= true;
                continue;
            }
            if (!z)
            {
                int y = upper_bound(a + 1, a + n + 1, a[x] + d) - a - 1;

                if (x == y)
                {
                    printf("%d\n", b[x].se);
                    break;
                }

                d -= abs(a[x] - a[y]);
                x = y;
                z ^= true;
            }
            else
            {
                int y = lower_bound(a + 1, a + n + 1, a[x] - d) - a;

                if (x == y)
                {
                    printf("%d\n", b[x].se);
                    break;
                }

                d -= abs(a[x] - a[y]);
                x = y;
                z ^= true;
            }
            assert(1 <= x && x <= n);
        }
    }
}

int main()
{
    #ifdef SOMETHING
    freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    #endif // SOMETHING
    //ios_base::sync_with_stdio(false), cin.tie(0);
    solv();
    return 0;
}

//while ((double)clock() / CLOCKS_PER_SEC <= 0.9){}


#include <bits/stdc++.h>
using namespace std;
#define m_p make_pair
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define fi first
#define se second
typedef long long ll;
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
mt19937 rnf(2100);
const int N = 200005;

int n;
int a[N];
pair<int, int> b[N];
int u[N];

void solv()
{
    int qq;
    scanf("%d%d", &n, &qq);
    for (int i = 1; i <= n; ++i)
    {
        scanf("%d", &a[i]);
        b[i] = m_p(a[i], i);
    }
    sort(a + 1, a + n + 1);
    sort(b + 1, b + n + 1);
    for (int i = 1; i <= n; ++i)
        u[b[i].se] = i;

    while (qq--)
    {
        int x, d;
        scanf("%d%d", &x, &d);
        x = u[x];
        bool z = false;

        if (n == 1)
        {
            printf("1\n");
            continue;
        }

        int qq = 0;

        while (1)
        {
            if (!z)
            {
                if (!(x < n && a[x] + d >= a[x + 1]))
                    z ^= true;
            }
            else
            {
                if (!(x > 1 && a[x] - d <= a[x - 1]))
                    z ^= true;
            }
            if (!z)
            {
                int y;
                y = upper_bound(a + 1, a + n + 1, a[x] + d) - a - 1;

                if (x == y)
                    break;

                if (!(y < n && a[y] + d >= a[y + 1]))
                {
                    if (a[y] - (d - abs(a[x] - a[y])) <= a[x])
                    {
                        if (x == 1 || a[y] - (d - abs(a[x] - a[y])) > a[x - 1])
                        {
                            int q = (d / abs(a[x] - a[y]));
                            d %= abs(a[x] - a[y]);

                            if (q % 2 == 1)
                            {
                                x = y;
                            }
                            continue;
                        }
                    }
                }
                d -= abs(a[x] - a[y]);
                x = y;
            }
            else
            {
                int y;
                y = lower_bound(a + 1, a + n + 1, a[x] - d) - a;

                if (x == y)
                    break;

                d -= abs(a[x] - a[y]);
                x = y;
            }
            assert(1 <= x && x <= n);
        }
        printf("%d\n", b[x].se);
    }
}

int main()
{
    #ifdef SOMETHING
    freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    #endif // SOMETHING
    //ios_base::sync_with_stdio(false), cin.tie(0);
    solv();
    return 0;
}

//while ((double)clock() / CLOCKS_PER_SEC <= 0.9){}


#include <bits/stdc++.h>
using namespace std;
#define m_p make_pair
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define fi first
#define se second
typedef long long ll;
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
mt19937 rnf(2100);
const int N = 200005;

int n;
int a[N];
pair<int, int> b[N];
int u[N];

void solv()
{
    int qq;
    scanf("%d%d", &n, &qq);
    for (int i = 1; i <= n; ++i)
    {
        scanf("%d", &a[i]);
        b[i] = m_p(a[i], i);
    }
    sort(a + 1, a + n + 1);
    sort(b + 1, b + n + 1);
    for (int i = 1; i <= n; ++i)
        u[b[i].se] = i;

    while (qq--)
    {
        int x, d;
        scanf("%d%d", &x, &d);
        x = u[x];
        bool z = false;

        if (n == 1)
        {
            printf("1\n");
            continue;
        }

        if (x == n && !z)
            z ^= true;
        if (x == 1 && z)
            z ^= true;

        int y = upper_bound(a + 1, a + n + 1, a[x] + d) - a - 1;

        d -= abs(a[x] - a[y]);
        x = y;
        z ^= true;

        if (x == n)
        {
            int q = d / (a[n] - a[1]);
            d %= (a[n] - a[1]);
            if (q % 2 == 1)
            {
                x = 1;
                z ^= true;
            }
        }

        while (1)
        {
            if (x == n && !z)
            {
                z ^= true;
                continue;
            }
            if (x == 1 && z)
            {
                z ^= true;
                continue;
            }
            if (!z)
            {
                int y = upper_bound(a + 1, a + n + 1, a[x] + d) - a - 1;

                if (x == y)
                {
                    printf("%d\n", b[x].se);
                    break;
                }

                d -= abs(a[x] - a[y]);
                x = y;
                z ^= true;
            }
            else
            {
                int y = lower_bound(a + 1, a + n + 1, a[x] - d) - a;

                if (x == y)
                {
                    printf("%d\n", b[x].se);
                    break;
                }

                d -= abs(a[x] - a[y]);
                x = y;
                z ^= true;
            }
            assert(1 <= x && x <= n);
        }
    }
}

int main()
{
    #ifdef SOMETHING
    freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    #endif // SOMETHING
    //ios_base::sync_with_stdio(false), cin.tie(0);
    solv();
    return 0;
}

//while ((double)clock() / CLOCKS_PER_SEC <= 0.9){}


#include <bits/stdc++.h>
using namespace std;
#define m_p make_pair
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define fi first
#define se second
typedef long long ll;
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
mt19937 rnf(2100);
const int N = 200005;

int n;
int a[N];
pair<int, int> b[N];
int u[N];

void solv()
{
    int qq;
    scanf("%d%d", &n, &qq);
    for (int i = 1; i <= n; ++i)
    {
        scanf("%d", &a[i]);
        b[i] = m_p(a[i], i);
    }
    sort(a + 1, a + n + 1);
    sort(b + 1, b + n + 1);
    for (int i = 1; i <= n; ++i)
        u[b[i].se] = i;

    while (qq--)
    {
        int x, d;
        scanf("%d%d", &x, &d);
        x = u[x];

        if (n == 1)
        {
            printf("1\n");
            continue;
        }

        while (1)
        {
            int y;
            if (x < n && a[x] + d >= a[x + 1])
                y = upper_bound(a + 1, a + n + 1, a[x] + d) - a - 1;
            else
                y = lower_bound(a + 1, a + n + 1, a[x] - d) - a;

            if (x == y)
                break;

            int q = (d / abs(a[x] - a[y]));
            d %= abs(a[x] - a[y]);
            if (q % 2 == 1)
                x = y;
        }
        printf("%d\n", b[x].se);
    }
}

int main()
{
    #ifdef SOMETHING
    freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    #endif // SOMETHING
    //ios_base::sync_with_stdio(false), cin.tie(0);
    solv();
    return 0;
}

//while ((double)clock() / CLOCKS_PER_SEC <= 0.9){}


#include <bits/stdc++.h>
using namespace std;
#define m_p make_pair
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define fi first
#define se second
typedef long long ll;
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
mt19937 rnf(2100);
const int N = 200005;

int n;
int a[N];
pair<int, int> b[N];
int u[N];

void solv()
{
    int qq;
    scanf("%d%d", &n, &qq);
    for (int i = 1; i <= n; ++i)
    {
        scanf("%d", &a[i]);
        b[i] = m_p(a[i], i);
    }
    sort(a + 1, a + n + 1);
    sort(b + 1, b + n + 1);
    for (int i = 1; i <= n; ++i)
        u[b[i].se] = i;

    while (qq--)
    {
        int x, d;
        scanf("%d%d", &x, &d);
        x = u[x];
        bool z = false;

        int y = upper_bound(a + 1, a + n + 1, a[x] + d) - a - 1;

        if (x == y)
        {
            printf("%d\n", b[x].se);
            continue;
        }

        d -= abs(a[x] - a[y]);
        x = y;
        z ^= true;

        /*if (x == n)
        {
            int q = d / (a[n] - a[1]);
            d %= (a[n] - a[1]);
            if (q % 2 == 1)
            {
                x = 1;
                z ^= true;
            }
        }*/

        while (1)
        {
            if (!z)
            {
                int y = upper_bound(a + 1, a + n + 1, a[x] + d) - a - 1;

                if (x == y)
                {
                    printf("%d\n", b[x].se);
                    break;
                }

                d -= abs(a[x] - a[y]);
                x = y;
                z ^= true;
            }
            else
            {
                int y = lower_bound(a + 1, a + n + 1, a[x] - d) - a;

                if (x == y)
                {
                    printf("%d\n", b[x].se);
                    break;
                }

                d -= abs(a[x] - a[y]);
                x = y;
                z ^= true;
            }
        }
    }
}

int main()
{
    #ifdef SOMETHING
    freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    #endif // SOMETHING
    //ios_base::sync_with_stdio(false), cin.tie(0);
    solv();
    return 0;
}

//while ((double)clock() / CLOCKS_PER_SEC <= 0.9){}


#include <bits/stdc++.h>
using namespace std;
#define m_p make_pair
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define fi first
#define se second
typedef long long ll;
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
mt19937 rnf(2100);
const int N = 200005;

int n;
int a[N];
pair<int, int> b[N];
int u[N];

void solv()
{
    int qq;
    scanf("%d%d", &n, &qq);
    for (int i = 1; i <= n; ++i)
    {
        scanf("%d", &a[i]);
        b[i] = m_p(a[i], i);
    }
    sort(a + 1, a + n + 1);
    sort(b + 1, b + n + 1);
    for (int i = 1; i <= n; ++i)
        u[b[i].se] = i;

    while (qq--)
    {
        int x, d;
        scanf("%d%d", &x, &d);
        x = u[x];
        bool z = false;

        if (n == 1)
        {
            printf("1\n");
            continue;
        }

        while (1)
        {
            if (x == n)
            {
                int q = d / (a[n] - a[1]);
                d %= (a[n] - a[1]);
                if (q % 2 == 1)
                    x = 1;
            }
            if (x == 1)
            {
                int q = d / (a[n] - a[1]);
                d %= (a[n] - a[1]);
                if (q % 2 == 1)
                    x = n;
            }

            if (!z)
            {
                int y;
                if (x < n && a[x] + d >= a[x + 1])
                    y = upper_bound(a + 1, a + n + 1, a[x] + d) - a - 1;
                else
                    y = lower_bound(a + 1, a + n + 1, a[x] - d) - a;

                if (x == y)
                {
                    printf("%d\n", b[x].se);
                    break;
                }

                d -= abs(a[x] - a[y]);
                x = y;
                z ^= true;
            }
            else
            {
                int y;
                if (x > 1 && a[x] - d <= a[x - 1])
                    y = lower_bound(a + 1, a + n + 1, a[x] - d) - a;
                else
                    y = upper_bound(a + 1, a + n + 1, a[x] + d) - a - 1;

                if (x == y)
                {
                    printf("%d\n", b[x].se);
                    break;
                }

                d -= abs(a[x] - a[y]);
                x = y;
                z ^= true;
            }
            assert(1 <= x && x <= n);
        }
    }
}

int main()
{
    #ifdef SOMETHING
    freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    #endif // SOMETHING
    //ios_base::sync_with_stdio(false), cin.tie(0);
    solv();
    return 0;
}

//while ((double)clock() / CLOCKS_PER_SEC <= 0.9){}


#include <bits/stdc++.h>
using namespace std;
#define m_p make_pair
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define fi first
#define se second
typedef long long ll;
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
mt19937 rnf(2100);
const int N = 200005;

int n;
int a[N];
pair<int, int> b[N];
int u[N];

void solv()
{
    int qq;
    scanf("%d%d", &n, &qq);
    for (int i = 1; i <= n; ++i)
    {
        scanf("%d", &a[i]);
        b[i] = m_p(a[i], i);
    }
    sort(a + 1, a + n + 1);
    sort(b + 1, b + n + 1);
    for (int i = 1; i <= n; ++i)
        u[b[i].se] = i;

    while (qq--)
    {
        int x, d;
        scanf("%d%d", &x, &d);
        x = u[x];
        bool z = false;

        if (n == 1)
        {
            printf("1\n");
            continue;
        }

        if (x == n && !z)
            z ^= true;
        if (x == 1 && z)
            z ^= true;

        if (x < n)
        {
            int y = upper_bound(a + 1, a + n + 1, a[x] + d) - a - 1;

            d -= abs(a[x] - a[y]);
            x = y;
            z ^= true;
        }

        if (x == n)
        {
            int q = d / (a[n] - a[1]);
            d %= (a[n] - a[1]);
            if (q % 2 == 1)
                x = 1;
        }

        while (1)
        {
            if (x == n && !z)
            {
                z ^= true;
                continue;
            }
            if (x == 1 && z)
            {
                z ^= true;
                continue;
            }
            if (!z)
            {
                int y = upper_bound(a + 1, a + n + 1, a[x] + d) - a - 1;

                if (x == y)
                {
                    printf("%d\n", b[x].se);
                    break;
                }

                d -= abs(a[x] - a[y]);
                x = y;
                z ^= true;
            }
            else
            {
                int y = lower_bound(a + 1, a + n + 1, a[x] - d) - a;

                if (x == y)
                {
                    printf("%d\n", b[x].se);
                    break;
                }

                d -= abs(a[x] - a[y]);
                x = y;
                z ^= true;
            }
            assert(1 <= x && x <= n);
        }
    }
}

int main()
{
    #ifdef SOMETHING
    freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    #endif // SOMETHING
    //ios_base::sync_with_stdio(false), cin.tie(0);
    solv();
    return 0;
}

//while ((double)clock() / CLOCKS_PER_SEC <= 0.9){}


#include <bits/stdc++.h>
using namespace std;
#define m_p make_pair
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define fi first
#define se second
typedef long long ll;
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
mt19937 rnf(2100);
const int N = 200005;

int n;
int a[N];
pair<int, int> b[N];
int u[N];

void solv()
{
    int qq;
    scanf("%d%d", &n, &qq);
    for (int i = 1; i <= n; ++i)
    {
        scanf("%d", &a[i]);
        b[i] = m_p(a[i], i);
    }
    sort(a + 1, a + n + 1);
    sort(b + 1, b + n + 1);
    for (int i = 1; i <= n; ++i)
        u[b[i].se] = i;

    while (qq--)
    {
        int x, d;
        scanf("%d%d", &x, &d);
        x = u[x];
        bool z = false;

        if (n == 1)
        {
            printf("1\n");
            continue;
        }

        while (1)
        {
            if (x == n)
            {
                int q = d / (a[n] - a[1]);
                d %= (a[n] - a[1]);
                if (q % 2 == 1)
                    x = 1;
            }
            if (x == 1)
            {
                int q = d / (a[n] - a[1]);
                d %= (a[n] - a[1]);
                if (q % 2 == 1)
                    x = n;
            }

            if (x == n && !z)
            {
                z ^= true;
                continue;
            }
            if (x == 1 && z)
            {
                z ^= true;
                continue;
            }

            if (!z)
            {
                int y = upper_bound(a + 1, a + n + 1, a[x] + d) - a - 1;

                if (x == y)
                {
                    printf("%d\n", b[x].se);
                    break;
                }

                d -= abs(a[x] - a[y]);
                x = y;
                z ^= true;
            }
            else
            {
                int y = lower_bound(a + 1, a + n + 1, a[x] - d) - a;

                if (x == y)
                {
                    printf("%d\n", b[x].se);
                    break;
                }

                d -= abs(a[x] - a[y]);
                x = y;
                z ^= true;
            }
            assert(1 <= x && x <= n);
        }
    }
}

int main()
{
    #ifdef SOMETHING
    freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    #endif // SOMETHING
    //ios_base::sync_with_stdio(false), cin.tie(0);
    solv();
    return 0;
}

//while ((double)clock() / CLOCKS_PER_SEC <= 0.9){}


//minamoto
#include<bits/stdc++.h>
#define R register
#define fp(i,a,b) for(R int i=(a),I=(b)+1;i<I;++i)
#define fd(i,a,b) for(R int i=(a),I=(b)-1;i>I;--i)
#define go(u) for(int i=head[u],v=e[i].v;i;i=e[i].nx,v=e[i].v)
template<class T>inline bool cmax(T&a,const T&b){return a<b?a=b,1:0;}
template<class T>inline bool cmin(T&a,const T&b){return a>b?a=b,1:0;}
using namespace std;
const int N=2e5+5;
int a[N],id[N],rk[N],n,m;
int gr(int x,int len);
int gl(int x,int len);
int main(){
//	freopen("testdata.in","r",stdin);
	scanf("%d%d",&n,&m);
	fp(i,1,n)scanf("%d",&a[i]),id[i]=i;
	sort(id+1,id+1+n,[](const int &x,const int &y){return a[x]<a[y];});
	fp(i,1,n)rk[id[i]]=i;
	sort(a+1,a+1+n);
	for(R int i=1,x,y,len;i<=m;++i){
		scanf("%d%d",&x,&len),x=rk[x];
		y=upper_bound(a+1,a+1+n,a[x]+len)-a-1;
		len-=a[y]-a[x];
		printf("%d\n",id[gl(y,len)]);
	}
	return 0;
}
int gl(int x,int len){
	int y=lower_bound(a+1,a+1+n,a[x]-len)-a;
	if(x==y)return x;
	int c=len/(a[x]-a[y]);
	int d=len%(a[x]-a[y]);
	return c&1?gr(y,d):gl(x,d);
}
int gr(int x,int len){
	int y=upper_bound(a+1,a+1+n,a[x]+len)-a-1;
	if(x==y)return x;
	int c=len/(a[y]-a[x]);
	int d=len%(a[y]-a[x]);
	return c&1?gl(y,d):gr(x,d);
}


//minamoto
#include<bits/stdc++.h>
#define R register
#define fp(i,a,b) for(R int i=(a),I=(b)+1;i<I;++i)
#define fd(i,a,b) for(R int i=(a),I=(b)-1;i>I;--i)
#define go(u) for(int i=head[u],v=e[i].v;i;i=e[i].nx,v=e[i].v)
template<class T>inline bool cmax(T&a,const T&b){return a<b?a=b,1:0;}
template<class T>inline bool cmin(T&a,const T&b){return a>b?a=b,1:0;}
using namespace std;
const int N=2e5+5;
int a[N],n,m;
int gr(int x,int len);
int gl(int x,int len);
int main(){
//	freopen("testdata.in","r",stdin);
	scanf("%d%d",&n,&m);
	fp(i,1,n)scanf("%d",&a[i]);
	for(R int i=1,x,y,len;i<=m;++i){
		scanf("%d%d",&x,&len);
		y=upper_bound(a+1,a+1+n,a[x]+len)-a-1;
		len-=a[y]-a[x];
		printf("%d\n",gl(y,len));
	}
	return 0;
}
int gl(int x,int len){
	int y=lower_bound(a+1,a+1+n,a[x]-len)-a;
	if(x==y)return x;
	int c=len/(a[x]-a[y]);
	int d=len%(a[x]-a[y]);
	return c&1?gr(y,d):gl(x,d);
}
int gr(int x,int len){
	int y=upper_bound(a+1,a+1+n,a[x]+len)-a-1;
	if(x==y)return x;
	int c=len/(a[y]-a[x]);
	int d=len%(a[y]-a[x]);
	return c&1?gl(y,d):gr(x,d);
}


// #pragma GCC optimize("O3")
// #pragma GCC target("sse4")

#include <bits/stdc++.h>

using namespace std;

#define GET_MACRO(_1, _2, _3, _4, NAME, ...) NAME
#define __FOR3(i, a, n, inc) for(int i = (a); (inc) > 0 ? i < (n) : i >= (n); i += (inc))
#define __FOR2(i, a, n) __FOR3(i, a, n, 1)
#define __FOR1(i, n) __FOR2(i, 0, n)
#define FOR(...) GET_MACRO(__VA_ARGS__, __FOR3, __FOR2, __FOR1)(__VA_ARGS__)

#define BOOST 			ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define ELO             exit(0)
#define ALL(a) 			(a).begin(), (a).end()
#define SZ(a) 			(int)(a).size()
#define TRAV(a, b) 		for (auto& a : b)
#define REV(a)          reverse(ALL(a))
#define SORT(a)         sort(ALL(a))
#define SORTR(a)        SORT(a), REV(a)
#define PB              push_back
#define F               first
#define S               second
using ll = 				long long;
using ld = 				long double; // 'long double' is 2.2 times slower than double
using pii = 			pair<int, int>;
using pll = 			pair<ll, ll>;
using pld =             pair<ld, ld>;
using vi = 				vector<int>;
using vvi =             vector<vi>;
using vll = 			vector<ll>;
using vvll =            vector<vll>;
using vpii = 			vector<pii>;
using vpll = 			vector<pll>;
using vld =             vector<ld>;
using vpld =            vector<pld>;

constexpr int MOD = 1e9 + 7; // 998244353
constexpr int INF = MOD;
constexpr ll LLINF = 1e18;
const ld PI = acos(-1);

template <class T> inline bool setmin(T& a, T b) {if (a > b) return a = b, 1; return 0; }
template <class T> inline bool setmax(T& a, T b) {if (a < b) return a = b, 1; return 0; }

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;

template <class key, class cmp = less<key>> using ordered_set = tree<key, null_type, cmp, rb_tree_tag, tree_order_statistics_node_update>;
template <class key, class cmp = less_equal<key>> using ordered_multiset = tree<key, null_type, cmp, rb_tree_tag, tree_order_statistics_node_update>;
//* find_by_order(k) - returns an iterator to the k-th largest element (counting from zero)
//* order_of_key(k)  - the number of items in a set that are strictly smaller than k.
template <class key, class value, class cmp = less<key>> using ordered_map = tree<key, value, cmp, rb_tree_tag, tree_order_statistics_node_update>;
using pref_trie = trie<string, null_type, trie_string_access_traits<>, pat_trie_tag, trie_prefix_search_node_update>;
// * prefix_range(s) - return iterator range, prefix equal to s

namespace input {
    template <class T> istream &operator>>(istream &os, vector<T> & vec) { for (auto& u : vec) os >> u; return os; }
    template<class T1, class T2> istream& operator>>(istream& os, pair<T1, T2>& p) { return os >> p.first >> p.second; }
    template <class T, size_t N> istream& operator>>(istream& os, array<T, N>& a) { for (auto& u : a) os >> u; return os; }

    void re() {}
    template <typename T, typename... args> void re(T& x, args&... tail) { cin >> x; re(tail...); }
} // namespace input
using namespace input;

namespace output {
    template <class T> ostream &operator<<(ostream &os, const vector<T> & vec){for (const auto& u : vec) os << u << " "; return os; }
    template<class T1, class T2> ostream& operator<<(ostream& os, const pair<T1, T2>& p) { return os << p.first << " " << p.second; }
    template <class T> ostream &operator<<(ostream &os, set<T> & con) { for (const auto& u : con) os << u << " "; return os; }
    template <class T, size_t N> ostream& operator<<(ostream& os, array<T, N>& a) { for (const auto& u : a) os << u << " "; return os; }

    void pr() {}
    template <typename T> void pr(const T& x) { cout << x; }
    template <typename T, typename... args> void pr(const T& x, const args&... tail) { cout << x << " "; pr(tail...);}
    template <typename T> void prs(const T& x) { cout << x << " "; }
    template <typename T, typename... args> void prs(const T& x, const args&... tail) { cout << x << " "; prs(tail...);}
    template <typename... args> void prln(const args&... tail) { pr(tail...); cout << "\n";}
} // namespace output
using namespace output;

namespace pair_magic {
	#define PT1T2 pair<T1,T2>
	#define TT1T2 template<class T1, class T2>
	TT1T2 inline PT1T2 operator+(const PT1T2 &p1, const PT1T2 &p2) { return PT1T2(p1.first + p2.first, p1.second + p2.second); }
	TT1T2 inline PT1T2& operator+=(PT1T2 &p1, const PT1T2 &p2) { p1.first += p2.first, p1.second += p2.second; return p1; }
	TT1T2 inline PT1T2 operator-(const PT1T2 &p1, const PT1T2 &p2) { return PT1T2(p1.first - p2.first, p1.second - p2.second); }
	TT1T2 inline PT1T2& operator-=(PT1T2 &p1, const PT1T2 &p2) { p1.first -= p2.first, p1.second -= p2.second; return p1; }
	#undef PT1T2
	#undef TT1T2
}
using namespace pair_magic;

namespace random_nsp {
	thread_local std::mt19937 gen{std::random_device{}()};
	template <typename T>T random(T min, T max){using dist = std::conditional_t<std::is_integral<T>::value, std::uniform_int_distribution<T>, std::uniform_real_distribution<T>>;return dist{min, max}(gen);}
	template <typename T> T randomINT(T min, T max) { return std::uniform_int_distribution<T>{min, max}(gen); }
}
using namespace random_nsp;

namespace triple {
	#define TT1T2T3 template<class T1, class T2, class T3>
	#define TRT1T2T3  triple<T1, T2, T3>
	TT1T2T3 struct triple { T1 a; T2 b; T3 c; triple() : a(T1()), b(T2()), c(T3()) {}; triple(T1 _a, T2 _b, T3 _c) :a(_a), b(_b), c(_c) {} };
	TT1T2T3 bool operator<(const TRT1T2T3&t1, const TRT1T2T3&t2) { if (t1.a != t2.a)return t1.a < t2.a; else if (t1.b != t2.b)return t1.b < t2.b; else return t1.c < t2.c; }
	TT1T2T3 bool operator>(const TRT1T2T3&t1, const TRT1T2T3&t2) { if (t1.a != t2.a)return t1.a > t2.a; else if (t1.b != t2.b)return t1.b > t2.b; else return t1.c > t2.c; }
	TT1T2T3 bool operator==(const TRT1T2T3&t1, const TRT1T2T3&t2) { return (t1.a == t2.a && t1.b == t2.b && t1.c == t2.c); }
	TT1T2T3 inline istream& operator >> (istream& os, triple<T1, T2, T3>& t) { return os >> t.a >> t.b >> t.c; }
	TT1T2T3 ostream& operator << (ostream& os, const triple<T1, T2, T3>& t) { return os << t.a << " " << t.b << " " << t.c; }
	#undef TRT1T2T3
	#undef TT1T2T3
	using tri =  triple<int, int, int>;
	using trll = triple<ll, ll, ll>;
	using vtri = vector<tri>;
    using vtrll = vector<trll>;
}
using namespace triple;

template <class T> T invGeneral(T a, T b) { // 0 < a < b, gcd(a,b) = 1
    a %= b;
    if (a == 0) return b == 1 ? 0 : -1;
    T x = invGeneral(b, a);
    return x == -1 ? -1 : ((1-(ll)b * x) / a + b) % b;
}

template<class T> struct modular {
	T val;
	explicit operator T() const { return val; }
	modular() { val = 0; }
	modular(const ll& v) {
		val = (-MOD <= v && v <= MOD) ? v : v % MOD;
		if (val < 0) val += MOD;
	}

	friend ostream& operator<<(ostream& os, const modular& a) { return os << a.val; }
	friend void pr(const modular& a) { pr(a.val); }
	friend void re(modular& a) { ll x; re(x); a = modular(x); }

	friend bool operator==(const modular& a, const modular& b) { return a.val == b.val; }
	friend bool operator!=(const modular& a, const modular& b) { return !(a == b); }
	friend bool operator<(const modular& a, const modular& b) { return a.val < b.val; }

	modular operator-() const { return modular(-val); }
	modular& operator+=(const modular& m) { if ((val += m.val) >= MOD) val -= MOD; return *this; }
	modular& operator-=(const modular& m) { if ((val -= m.val) < 0) val += MOD; return *this; }
	modular& operator*=(const modular& m) { val = (ll)val*m.val%MOD; return *this; }
	friend modular pow(modular a, ll p) {
		modular ans = 1; for (; p; p /= 2, a *= a) if (p&1) ans *= a;
		return ans;
	}
	friend modular inv(const modular& a) {
		auto i = invGeneral(a.val,MOD); assert(i != -1);
		return i;
	} // equivalent to return exp(b,MOD-2) if MOD is prime
	modular& operator/=(const modular& m) { return (*this) *= inv(m); }

	friend modular operator+(modular a, const modular& b) { return a += b; }
	friend modular operator-(modular a, const modular& b) { return a -= b; }
	friend modular operator*(modular a, const modular& b) { return a *= b; }
	friend modular operator/(modular a, const modular& b) { return a /= b; }
};

using mi = modular<int>;
using pmi = pair<mi,mi>;
using vmi = vector<mi>;
using vpmi = vector<pmi>;

namespace debug {
    template < typename _T > inline void _debug(const char *s, _T x) { cerr << s << " = " << x << "\n"; }
    template < typename _T, typename... args > void _debug(const char *s, _T x, args... a) { while(*s != ',') cerr << *s++; cerr << " = " << x << ','; _debug(s + 1, a...); }

    #if 1
        #define debug(...) _debug(#__VA_ARGS__, __VA_ARGS__)
        #define cerr cout
    #else
        #define debug(...) 1999
        #define cerr if(0) cout
    #endif
} // namespace debug
using namespace debug;

//////////////_________CODE_________//////////////

int main() {
    BOOST;
    int n, m; re(n, m);
	vpii x(n);
	FOR(i, n) re(x[i].F), x[i].S = i;
	SORT(x);
	vi nr(n);
	FOR(i, n) nr[x[i].S] = i;

	vi L(n), R(n);
	FOR(i, n) L[i] = x[i].F, R[i] = -x[i].F;
	SORT(R);

	FOR(_, m) {
		int a, l; re(a, l);
		a--;
		a = nr[a];
		while(true) {
			auto it = prev(upper_bound(ALL(L), L[a] + l)) - L.begin();
			pii sr = {it, l - (L[it] - L[a])};
			int nx = n - 1 - sr.F;
			it = prev(upper_bound(ALL(R), R[nx] + sr.S)) - R.begin();
			pii sl = {n - 1 - it, sr.S - (R[it] - R[nx])};

			if(sl.F == a) {
				if(l == sl.S) {
					prln(x[a].S + 1);
					break;
				}

				l %= (l - sl.S);
			} else {
				a = sl.F, l = sl.S;
			}
		}
	}
}


#ifdef ONPC
# define _GLIBCXX_DEBUG
#define deb(a) cerr << "nu smotri pidor " << #a << " = " << a << endl;
#else
#define deb(a)
#endif
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma,sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

using namespace std;

typedef long long ll;
typedef long double ld;
ll MOD = 1e9 + 7;

ll n;
ll used[200000];
vector<pair<ll, ll> > x;
vector<ll> tmp;

ll dfs(ll v, ll l){
    if(used[v]){
        l = l % (l - used[v]);
    }
    tmp.push_back(v);
    used[v] = l;
    ll id = upper_bound(x.begin(), x.end(), make_pair(l + x[v].first, n)) - x.begin();
    id--;
    if (id == v){
        ll id2 = lower_bound(x.begin(), x.end(),  make_pair(x[v].first - l, -1ll)) - x.begin();
        if (id2 == v){
            return x[v].second;
        }
        else{
            return dfs(id2, l - x[v].first + x[id2].first);
        }
    }
    else{
        return dfs(id, l - x[id].first + x[v].first);
    }
}

int main() {
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0), cout << fixed << setprecision(20);
    ll m;
    cin >> n >> m;
    for (int i = 0; i < n; i++){
        ll xx;
        cin >> xx;
        x.push_back({xx, i + 1});
    }
    sort(x.begin(), x.end());
    for (int i = 0; i < m; i++){
        ll ii, tt;
        cin >> ii >> tt;
        cout << dfs(ii - 1, tt) << endl;
        for (auto j : tmp){
            used[j] = 0;
        }
        tmp.clear();
    }

#ifdef ONPC
    cerr << endl << "finished in " << clock() * 1.0 / CLOCKS_PER_SEC << " sec" << endl;
#endif
}
//egor lox


#ifdef ONPC
# define _GLIBCXX_DEBUG
#define deb(a) cerr << "nu smotri pidor " << #a << " = " << a << endl;
#else
#define deb(a)
#endif
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma,sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

using namespace std;

typedef long long ll;
typedef long double ld;
ll MOD = 1e9 + 7;

ll n;
ll used[200000];
ll num[200000];
vector<pair<ll, ll> > x;
vector<ll> tmp;

ll dfs(ll v, ll l){
    if(used[v]){
        l = l % (l - used[v]);
    }
    tmp.push_back(v);
    used[v] = l;
    ll id = upper_bound(x.begin(), x.end(), make_pair(l + x[v].first, n)) - x.begin();
    id--;
    if (id == v){
        ll id2 = lower_bound(x.begin(), x.end(),  make_pair(x[v].first - l, -1ll)) - x.begin();
        if (id2 == v){
            return x[v].second;
        }
        else{
            return dfs(id2, l - x[v].first + x[id2].first);
        }
    }
    else{
        return dfs(id, l - x[id].first + x[v].first);
    }
}

int main() {
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0), cout << fixed << setprecision(20);
    ll m;
    cin >> n >> m;
    for (int i = 0; i < n; i++){
        ll xx;
        cin >> xx;
        x.push_back({xx, i + 1});
    }
    sort(x.begin(), x.end());
    for (int i = 0; i < x.size(); i++){
        num[x[i].second - 1] = i;
    }
    for (int i = 0; i < m; i++){
        ll ii, tt;
        cin >> ii >> tt;
        cout << dfs(num[ii - 1], tt) << endl;
        for (auto j : tmp){
            used[j] = 0;
        }
        tmp.clear();
    }

#ifdef ONPC
    cerr << endl << "finished in " << clock() * 1.0 / CLOCKS_PER_SEC << " sec" << endl;
#endif
}
//egor lox


#pragma region Macros
#pragma GCC optimize("O3")
#pragma GCC target("avx2,avx")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define rep2(i, a, b) for(ll i = a; i <= b; ++i)
#define rep(i, n) for(ll i = 0; i < n; ++i)
#define rep3(i, a, b) for(ll i = a; i >= b; --i)
#define pii pair<int, int>
#define pll pair<ll, ll>
#define pb push_back
#define eb emplace_back
#define vi vector<int>
#define vll vector<ll>
#define vpi vector<pii>
#define vpll vector<pll>
#define overload2(_1, _2, name, ...) name
#define vec(type, name, ...) vector<type> name(__VA_ARGS__)
#define VEC(type, name, size)                                                                                \
    vector<type> name(size);                                                                                \
    IN(name)
#define vv(type, name, h, ...) vector<vector<type>> name(h, vector<type>(__VA_ARGS__))
#define VV(type, name, h, w)                                                                                \
    vector<vector<type>> name(h, vector<type>(w));                                                                                \
    IN(name)
#define vvv(type, name, h, w, ...) vector<vector<vector<type>>> name(h, vector<vector<type>>(w, vector<type>(__VA_ARGS__)))
#define vvvv(type, name, a, b, c, ...)                                                                                \
    vector<vector<vector<vector<type>>>> name(a, vector<vector<vector<type>>>(b, vector<vector<type>>(c, vector<type>(__VA_ARGS__))))
#define fi first
#define se second
#define all(c) begin(c), end(c)
#define lb(c, x) distance((c).begin(), lower_bound(all(c), (x)))
#define ub(c, x) distance((c).begin(), upper_bound(all(c), (x)))
using namespace std;
string YES[2] = {"NO", "YES"};
string Yes[2] = {"No", "Yes"};
string yes[2] = {"no", "yes"};
template <class T> using pq = priority_queue<T>;
template <class T> using pqg = priority_queue<T, vector<T>, greater<T>>;
#define si(c) (int)(c).size()
#define INT(...)                                                                                \
    int __VA_ARGS__;                                                                                \
    IN(__VA_ARGS__)
#define LL(...)                                                                                \
    ll __VA_ARGS__;                                                                                \
    IN(__VA_ARGS__)
#define STR(...)                                                                                \
    string __VA_ARGS__;                                                                                \
    IN(__VA_ARGS__)
#define CHR(...)                                                                                \
    char __VA_ARGS__;                                                                                \
    IN(__VA_ARGS__)
#define DBL(...)                                                                                \
    double __VA_ARGS__;                                                                                \
    IN(__VA_ARGS__)
int scan() { return getchar(); }
void scan(int &a) { cin >> a; }
void scan(long long &a) { cin >> a; }
void scan(char &a) { cin >> a; }
void scan(double &a) { cin >> a; }
void scan(string &a) { cin >> a; }
template <class T, class S> void scan(pair<T, S> &p) { scan(p.first), scan(p.second); }
template <class T> void scan(vector<T> &);
template <class T> void scan(vector<T> &a) {
    for(auto &i : a) scan(i);
}
template <class T> void scan(T &a) { cin >> a; }
void IN() {}
template <class Head, class... Tail> void IN(Head &head, Tail &... tail) {
    scan(head);
    IN(tail...);
}
template <class T, class S> inline bool chmax(T &a, S b) {
    if(a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T, class S> inline bool chmin(T &a, S b) {
    if(a > b) {
        a = b;
        return 1;
    }
    return 0;
}
vi iota(int n) {
    vi a(n);
    iota(all(a), 0);
    return a;
}
template <typename T> vi iota(vector<T> &a, bool greater = false) {
    vi res(a.size());
    iota(all(res), 0);
    sort(all(res), [&](int i, int j) {
        if(greater) return a[i] > a[j];
        return a[i] < a[j];
    });
    return res;
}
#define UNIQUE(x) sort(all(x)), x.erase(unique(all(x)), x.end())
vector<pll> factor(ll x) {
    vector<pll> ans;
    for(ll i = 2; i * i <= x; i++)
        if(x % i == 0) {
            ans.push_back({i, 1});
            while((x /= i) % i == 0) ans.back().second++;
        }
    if(x != 1) ans.push_back({x, 1});
    return ans;
}
template <class T> vector<T> divisor(T x) {
    vector<T> ans;
    for(T i = 1; i * i <= x; i++)
        if(x % i == 0) {
            ans.pb(i);
            if(i * i != x) ans.pb(x / i);
        }
    return ans;
}
template <typename T> void zip(vector<T> &x) {
    vector<T> y = x;
    sort(all(y));
    for(int i = 0; i < x.size(); ++i) { x[i] = lb(y, x[i]); }
}
int popcount(ll x) { return __builtin_popcountll(x); }
struct Setup_io {
    Setup_io() {
        ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
        cout << fixed << setprecision(15);
    }
} setup_io;
int in() {
    int x;
    cin >> x;
    return x;
}
ll lin() {
    unsigned long long x;
    cin >> x;
    return x;
}

template <typename T> struct edge {
    int from, to;
    T cost;
    int id;
    edge(int to, T cost) : from(-1), to(to), cost(cost) {}
    edge(int from, int to, T cost) : from(from), to(to), cost(cost) {}
    edge(int from, int to, T cost, int id) : from(from), to(to), cost(cost), id(id) {}
    edge &operator=(const int &x) {
        to = x;
        return *this;
    }
    operator int() const { return to; }
};
template <typename T> using Edges = vector<edge<T>>;

using Tree = vector<vector<int>>;
using Graph = vector<vector<int>>;
template <class T> using Wgraph = vector<vector<edge<T>>>;
Graph getG(int n, int m = -1, bool directed = false, int margin = 1) {
    Tree res(n);
    if(m == -1) m = n - 1;
    while(m--) {
        int a, b;
        cin >> a >> b;
        a -= margin, b -= margin;
        res[a].emplace_back(b);
        if(!directed) res[b].emplace_back(a);
    }
    return move(res);
}
template <class T> Wgraph<T> getWg(int n, int m = -1, bool directed = false, int margin = 1) {
    Wgraph<T> res(n);
    if(m == -1) m = n - 1;
    while(m--) {
        int a, b;
        T c;
        cin >> a >> b >> c;
        a -= margin, b -= margin;
        res[a].emplace_back(b, c);
        if(!directed) res[b].emplace_back(a, c);
    }
    return move(res);
}

#define i128 __int128_t
#define ull unsigned long long int
#define TEST                                                                                \
    INT(testcases);                                                                                \
    while(testcases--)
template <class T> ostream &operator<<(ostream &os, const vector<T> &v) {
    for(auto &e : v) cout << e << " ";
    cout << endl;
    return os;
}
template <class T, class S> ostream &operator<<(ostream &os, const pair<T, S> &p) {
    cout << "(" << p.fi << ", " << p.se << ")";
    return os;
}
template <class S, class T> string to_string(pair<S, T> p) { return "(" + to_string(p.first) + "," + to_string(p.second) + ")"; }
template <class A> string to_string(A v) {
    if(v.empty()) return "{}";
    string ret = "{";
    for(auto &x : v) ret += to_string(x) + ",";
    ret.back() = '}';
    return ret;
}

void dump() { cerr << endl; }
template <class Head, class... Tail> void dump(Head head, Tail... tail) {
    cerr << to_string(head) << " ";
    dump(tail...);
}
#define endl '\n'
#ifdef _LOCAL
#undef endl
#define debug(x)                                                                                \
    cout << #x << ": ";                                                                                \
    dump(x)
#else
#define debug(x)
#endif
// mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

// int rnd(int n) { return uniform_int_distribution<int>(0, n - 1)(rng); }
// ll rndll(ll n) { return uniform_int_distribution<ll>(0, n - 1)(rng); }

template <typename T> static constexpr T inf = numeric_limits<T>::max() / 2;
#pragma endregion

int main() {
    INT(n, m);
    VEC(int, a, n);
    auto solve = [&](auto &&f, int i, int l, int p) -> int {
        if(p) {
            int j = ub(a, a[i] + l) - 1;
            if(i == j) return i;
            if(a[j] - a[i] >= l / 2) return f(f, j, l - (a[j] - a[i]), p ^ 1);
            int d = a[j] - a[i];
            int nl = l - d;
            int ii = lb(a, a[j] - nl);
            if(ii < i) return f(f, ii, nl - (a[j] - a[ii]), p);
            return f(f, i, l % (d * 2), p);
        } else {
            int j = lb(a, a[i] - l);
            if(i == j) return i;
            return f(f, j, l - (a[i] - a[j]), p ^ 1);
        }
    };
    while(m--) {
        INT(x, l);
        cout << solve(solve, --x, l, 1) + 1 << endl;
    }
}


#pragma region Macros
#pragma GCC optimize("O3")
#pragma GCC target("avx2,avx")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define rep2(i, a, b) for(ll i = a; i <= b; ++i)
#define rep(i, n) for(ll i = 0; i < n; ++i)
#define rep3(i, a, b) for(ll i = a; i >= b; --i)
#define pii pair<int, int>
#define pll pair<ll, ll>
#define pb push_back
#define eb emplace_back
#define vi vector<int>
#define vll vector<ll>
#define vpi vector<pii>
#define vpll vector<pll>
#define overload2(_1, _2, name, ...) name
#define vec(type, name, ...) vector<type> name(__VA_ARGS__)
#define VEC(type, name, size)                                                                                \
    vector<type> name(size);                                                                                \
    IN(name)
#define vv(type, name, h, ...) vector<vector<type>> name(h, vector<type>(__VA_ARGS__))
#define VV(type, name, h, w)                                                                                \
    vector<vector<type>> name(h, vector<type>(w));                                                                                \
    IN(name)
#define vvv(type, name, h, w, ...) vector<vector<vector<type>>> name(h, vector<vector<type>>(w, vector<type>(__VA_ARGS__)))
#define vvvv(type, name, a, b, c, ...)                                                                                \
    vector<vector<vector<vector<type>>>> name(a, vector<vector<vector<type>>>(b, vector<vector<type>>(c, vector<type>(__VA_ARGS__))))
#define fi first
#define se second
#define all(c) begin(c), end(c)
#define lb(c, x) distance((c).begin(), lower_bound(all(c), (x)))
#define ub(c, x) distance((c).begin(), upper_bound(all(c), (x)))
using namespace std;
string YES[2] = {"NO", "YES"};
string Yes[2] = {"No", "Yes"};
string yes[2] = {"no", "yes"};
template <class T> using pq = priority_queue<T>;
template <class T> using pqg = priority_queue<T, vector<T>, greater<T>>;
#define si(c) (int)(c).size()
#define INT(...)                                                                                \
    int __VA_ARGS__;                                                                                \
    IN(__VA_ARGS__)
#define LL(...)                                                                                \
    ll __VA_ARGS__;                                                                                \
    IN(__VA_ARGS__)
#define STR(...)                                                                                \
    string __VA_ARGS__;                                                                                \
    IN(__VA_ARGS__)
#define CHR(...)                                                                                \
    char __VA_ARGS__;                                                                                \
    IN(__VA_ARGS__)
#define DBL(...)                                                                                \
    double __VA_ARGS__;                                                                                \
    IN(__VA_ARGS__)
int scan() { return getchar(); }
void scan(int &a) { cin >> a; }
void scan(long long &a) { cin >> a; }
void scan(char &a) { cin >> a; }
void scan(double &a) { cin >> a; }
void scan(string &a) { cin >> a; }
template <class T, class S> void scan(pair<T, S> &p) { scan(p.first), scan(p.second); }
template <class T> void scan(vector<T> &);
template <class T> void scan(vector<T> &a) {
    for(auto &i : a) scan(i);
}
template <class T> void scan(T &a) { cin >> a; }
void IN() {}
template <class Head, class... Tail> void IN(Head &head, Tail &... tail) {
    scan(head);
    IN(tail...);
}
template <class T, class S> inline bool chmax(T &a, S b) {
    if(a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T, class S> inline bool chmin(T &a, S b) {
    if(a > b) {
        a = b;
        return 1;
    }
    return 0;
}
vi iota(int n) {
    vi a(n);
    iota(all(a), 0);
    return a;
}
template <typename T> vi iota(vector<T> &a, bool greater = false) {
    vi res(a.size());
    iota(all(res), 0);
    sort(all(res), [&](int i, int j) {
        if(greater) return a[i] > a[j];
        return a[i] < a[j];
    });
    return res;
}
#define UNIQUE(x) sort(all(x)), x.erase(unique(all(x)), x.end())
vector<pll> factor(ll x) {
    vector<pll> ans;
    for(ll i = 2; i * i <= x; i++)
        if(x % i == 0) {
            ans.push_back({i, 1});
            while((x /= i) % i == 0) ans.back().second++;
        }
    if(x != 1) ans.push_back({x, 1});
    return ans;
}
template <class T> vector<T> divisor(T x) {
    vector<T> ans;
    for(T i = 1; i * i <= x; i++)
        if(x % i == 0) {
            ans.pb(i);
            if(i * i != x) ans.pb(x / i);
        }
    return ans;
}
template <typename T> void zip(vector<T> &x) {
    vector<T> y = x;
    sort(all(y));
    for(int i = 0; i < x.size(); ++i) { x[i] = lb(y, x[i]); }
}
int popcount(ll x) { return __builtin_popcountll(x); }
struct Setup_io {
    Setup_io() {
        ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
        cout << fixed << setprecision(15);
    }
} setup_io;
int in() {
    int x;
    cin >> x;
    return x;
}
ll lin() {
    unsigned long long x;
    cin >> x;
    return x;
}

template <typename T> struct edge {
    int from, to;
    T cost;
    int id;
    edge(int to, T cost) : from(-1), to(to), cost(cost) {}
    edge(int from, int to, T cost) : from(from), to(to), cost(cost) {}
    edge(int from, int to, T cost, int id) : from(from), to(to), cost(cost), id(id) {}
    edge &operator=(const int &x) {
        to = x;
        return *this;
    }
    operator int() const { return to; }
};
template <typename T> using Edges = vector<edge<T>>;

using Tree = vector<vector<int>>;
using Graph = vector<vector<int>>;
template <class T> using Wgraph = vector<vector<edge<T>>>;
Graph getG(int n, int m = -1, bool directed = false, int margin = 1) {
    Tree res(n);
    if(m == -1) m = n - 1;
    while(m--) {
        int a, b;
        cin >> a >> b;
        a -= margin, b -= margin;
        res[a].emplace_back(b);
        if(!directed) res[b].emplace_back(a);
    }
    return move(res);
}
template <class T> Wgraph<T> getWg(int n, int m = -1, bool directed = false, int margin = 1) {
    Wgraph<T> res(n);
    if(m == -1) m = n - 1;
    while(m--) {
        int a, b;
        T c;
        cin >> a >> b >> c;
        a -= margin, b -= margin;
        res[a].emplace_back(b, c);
        if(!directed) res[b].emplace_back(a, c);
    }
    return move(res);
}

#define i128 __int128_t
#define ull unsigned long long int
#define TEST                                                                                \
    INT(testcases);                                                                                \
    while(testcases--)
template <class T> ostream &operator<<(ostream &os, const vector<T> &v) {
    for(auto &e : v) cout << e << " ";
    cout << endl;
    return os;
}
template <class T, class S> ostream &operator<<(ostream &os, const pair<T, S> &p) {
    cout << "(" << p.fi << ", " << p.se << ")";
    return os;
}
template <class S, class T> string to_string(pair<S, T> p) { return "(" + to_string(p.first) + "," + to_string(p.second) + ")"; }
template <class A> string to_string(A v) {
    if(v.empty()) return "{}";
    string ret = "{";
    for(auto &x : v) ret += to_string(x) + ",";
    ret.back() = '}';
    return ret;
}

void dump() { cerr << endl; }
template <class Head, class... Tail> void dump(Head head, Tail... tail) {
    cerr << to_string(head) << " ";
    dump(tail...);
}
#define endl '\n'
#ifdef _LOCAL
#undef endl
#define debug(x)                                                                                \
    cout << #x << ": ";                                                                                \
    dump(x)
#else
#define debug(x)
#endif
// mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

// int rnd(int n) { return uniform_int_distribution<int>(0, n - 1)(rng); }
// ll rndll(ll n) { return uniform_int_distribution<ll>(0, n - 1)(rng); }

template <typename T> static constexpr T inf = numeric_limits<T>::max() / 2;
#pragma endregion

int main() {
    INT(n, m);
    VEC(int, A, n);
    map<int, int> mp;
    rep(i, n) mp[A[i]] = i + 1;
    auto a = A;
    sort(all(a));
    auto solve = [&](auto &&f, int i, int l, int p, int s = 0) -> int {
        if(p) {
            int j = ub(a, a[i] + l) - 1;
            if(i == j) return (s ? i : f(f, i, l, p ^ 1, 1));
            if(a[j] - a[i] >= l / 2) return f(f, j, l - (a[j] - a[i]), p ^ 1);
            int d = a[j] - a[i];
            int nl = l - d;
            int ii = lb(a, a[j] - nl);
            if(ii < i) return f(f, ii, nl - (a[j] - a[ii]), p);
            return f(f, i, l % (d * 2), p);
        } else {
            int j = lb(a, a[i] - l);
            if(i == j) return (s ? i : f(f, i, l, p ^ 1, 1));
            return f(f, j, l - (a[i] - a[j]), p ^ 1);
        }
    };
    while(m--) {
        INT(x, l);
        cout << mp[a[solve(solve, lb(a, A[--x]), l, 1)]] << endl;
    }
}


#pragma region Macros
#pragma GCC optimize("O3")
#pragma GCC target("avx2,avx")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define rep2(i, a, b) for(ll i = a; i <= b; ++i)
#define rep(i, n) for(ll i = 0; i < n; ++i)
#define rep3(i, a, b) for(ll i = a; i >= b; --i)
#define pii pair<int, int>
#define pll pair<ll, ll>
#define pb push_back
#define eb emplace_back
#define vi vector<int>
#define vll vector<ll>
#define vpi vector<pii>
#define vpll vector<pll>
#define overload2(_1, _2, name, ...) name
#define vec(type, name, ...) vector<type> name(__VA_ARGS__)
#define VEC(type, name, size)                                                                                \
    vector<type> name(size);                                                                                \
    IN(name)
#define vv(type, name, h, ...) vector<vector<type>> name(h, vector<type>(__VA_ARGS__))
#define VV(type, name, h, w)                                                                                \
    vector<vector<type>> name(h, vector<type>(w));                                                                                \
    IN(name)
#define vvv(type, name, h, w, ...) vector<vector<vector<type>>> name(h, vector<vector<type>>(w, vector<type>(__VA_ARGS__)))
#define vvvv(type, name, a, b, c, ...)                                                                                \
    vector<vector<vector<vector<type>>>> name(a, vector<vector<vector<type>>>(b, vector<vector<type>>(c, vector<type>(__VA_ARGS__))))
#define fi first
#define se second
#define all(c) begin(c), end(c)
#define lb(c, x) distance((c).begin(), lower_bound(all(c), (x)))
#define ub(c, x) distance((c).begin(), upper_bound(all(c), (x)))
using namespace std;
string YES[2] = {"NO", "YES"};
string Yes[2] = {"No", "Yes"};
string yes[2] = {"no", "yes"};
template <class T> using pq = priority_queue<T>;
template <class T> using pqg = priority_queue<T, vector<T>, greater<T>>;
#define si(c) (int)(c).size()
#define INT(...)                                                                                \
    int __VA_ARGS__;                                                                                \
    IN(__VA_ARGS__)
#define LL(...)                                                                                \
    ll __VA_ARGS__;                                                                                \
    IN(__VA_ARGS__)
#define STR(...)                                                                                \
    string __VA_ARGS__;                                                                                \
    IN(__VA_ARGS__)
#define CHR(...)                                                                                \
    char __VA_ARGS__;                                                                                \
    IN(__VA_ARGS__)
#define DBL(...)                                                                                \
    double __VA_ARGS__;                                                                                \
    IN(__VA_ARGS__)
int scan() { return getchar(); }
void scan(int &a) { cin >> a; }
void scan(long long &a) { cin >> a; }
void scan(char &a) { cin >> a; }
void scan(double &a) { cin >> a; }
void scan(string &a) { cin >> a; }
template <class T, class S> void scan(pair<T, S> &p) { scan(p.first), scan(p.second); }
template <class T> void scan(vector<T> &);
template <class T> void scan(vector<T> &a) {
    for(auto &i : a) scan(i);
}
template <class T> void scan(T &a) { cin >> a; }
void IN() {}
template <class Head, class... Tail> void IN(Head &head, Tail &... tail) {
    scan(head);
    IN(tail...);
}
template <class T, class S> inline bool chmax(T &a, S b) {
    if(a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T, class S> inline bool chmin(T &a, S b) {
    if(a > b) {
        a = b;
        return 1;
    }
    return 0;
}
vi iota(int n) {
    vi a(n);
    iota(all(a), 0);
    return a;
}
template <typename T> vi iota(vector<T> &a, bool greater = false) {
    vi res(a.size());
    iota(all(res), 0);
    sort(all(res), [&](int i, int j) {
        if(greater) return a[i] > a[j];
        return a[i] < a[j];
    });
    return res;
}
#define UNIQUE(x) sort(all(x)), x.erase(unique(all(x)), x.end())
vector<pll> factor(ll x) {
    vector<pll> ans;
    for(ll i = 2; i * i <= x; i++)
        if(x % i == 0) {
            ans.push_back({i, 1});
            while((x /= i) % i == 0) ans.back().second++;
        }
    if(x != 1) ans.push_back({x, 1});
    return ans;
}
template <class T> vector<T> divisor(T x) {
    vector<T> ans;
    for(T i = 1; i * i <= x; i++)
        if(x % i == 0) {
            ans.pb(i);
            if(i * i != x) ans.pb(x / i);
        }
    return ans;
}
template <typename T> void zip(vector<T> &x) {
    vector<T> y = x;
    sort(all(y));
    for(int i = 0; i < x.size(); ++i) { x[i] = lb(y, x[i]); }
}
int popcount(ll x) { return __builtin_popcountll(x); }
struct Setup_io {
    Setup_io() {
        ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
        cout << fixed << setprecision(15);
    }
} setup_io;
int in() {
    int x;
    cin >> x;
    return x;
}
ll lin() {
    unsigned long long x;
    cin >> x;
    return x;
}

template <typename T> struct edge {
    int from, to;
    T cost;
    int id;
    edge(int to, T cost) : from(-1), to(to), cost(cost) {}
    edge(int from, int to, T cost) : from(from), to(to), cost(cost) {}
    edge(int from, int to, T cost, int id) : from(from), to(to), cost(cost), id(id) {}
    edge &operator=(const int &x) {
        to = x;
        return *this;
    }
    operator int() const { return to; }
};
template <typename T> using Edges = vector<edge<T>>;

using Tree = vector<vector<int>>;
using Graph = vector<vector<int>>;
template <class T> using Wgraph = vector<vector<edge<T>>>;
Graph getG(int n, int m = -1, bool directed = false, int margin = 1) {
    Tree res(n);
    if(m == -1) m = n - 1;
    while(m--) {
        int a, b;
        cin >> a >> b;
        a -= margin, b -= margin;
        res[a].emplace_back(b);
        if(!directed) res[b].emplace_back(a);
    }
    return move(res);
}
template <class T> Wgraph<T> getWg(int n, int m = -1, bool directed = false, int margin = 1) {
    Wgraph<T> res(n);
    if(m == -1) m = n - 1;
    while(m--) {
        int a, b;
        T c;
        cin >> a >> b >> c;
        a -= margin, b -= margin;
        res[a].emplace_back(b, c);
        if(!directed) res[b].emplace_back(a, c);
    }
    return move(res);
}

#define i128 __int128_t
#define ull unsigned long long int
#define TEST                                                                                \
    INT(testcases);                                                                                \
    while(testcases--)
template <class T> ostream &operator<<(ostream &os, const vector<T> &v) {
    for(auto &e : v) cout << e << " ";
    cout << endl;
    return os;
}
template <class T, class S> ostream &operator<<(ostream &os, const pair<T, S> &p) {
    cout << "(" << p.fi << ", " << p.se << ")";
    return os;
}
template <class S, class T> string to_string(pair<S, T> p) { return "(" + to_string(p.first) + "," + to_string(p.second) + ")"; }
template <class A> string to_string(A v) {
    if(v.empty()) return "{}";
    string ret = "{";
    for(auto &x : v) ret += to_string(x) + ",";
    ret.back() = '}';
    return ret;
}

void dump() { cerr << endl; }
template <class Head, class... Tail> void dump(Head head, Tail... tail) {
    cerr << to_string(head) << " ";
    dump(tail...);
}
#define endl '\n'
#ifdef _LOCAL
#undef endl
#define debug(x)                                                                                \
    cout << #x << ": ";                                                                                \
    dump(x)
#else
#define debug(x)
#endif
// mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

// int rnd(int n) { return uniform_int_distribution<int>(0, n - 1)(rng); }
// ll rndll(ll n) { return uniform_int_distribution<ll>(0, n - 1)(rng); }

template <typename T> static constexpr T inf = numeric_limits<T>::max() / 2;
#pragma endregion

int main() {
    INT(n, m);
    VEC(int, A, n);
    map<int, int> mp;
    rep(i, n) mp[A[i]] = i + 1;
    auto a = A;
    sort(all(a));
    auto solve = [&](auto &&f, int i, int l, int p) -> int {
        if(p) {
            int j = ub(a, a[i] + l) - 1;
            if(i == j) return i;
            if(a[j] - a[i] >= l / 2) return f(f, j, l - (a[j] - a[i]), p ^ 1);
            int d = a[j] - a[i];
            int nl = l - d;
            int ii = lb(a, a[j] - nl);
            if(ii < i) return f(f, ii, nl - (a[j] - a[ii]), p);
            return f(f, i, l % (d * 2), p);
        } else {
            int j = lb(a, a[i] - l);
            if(i == j) return i;
            return f(f, j, l - (a[i] - a[j]), p ^ 1);
        }
    };
    while(m--) {
        INT(x, l);
        cout << mp[a[solve(solve, lb(a, A[--x]), l, 1)]] << endl;
    }
}


/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author majk
 */

#ifndef MAJK_LIB
#define MAJK_LIB

#include <vector>
#include <stack>
#include <iostream>
#include <unordered_map>
#include <unordered_set>
#include <map>
#include <iomanip>
#include <set>
#include <functional>
#include <fstream>
#include <algorithm>
#include <cassert>
#include <cmath>
#include <string>
#include <sstream>
#include <queue>
#include <bitset>
using namespace std;

#define x first
#define y second
typedef std::pair<int,int> pii; typedef long long ll; typedef unsigned long long ull; typedef unsigned int ui; typedef pair<ui,ui> puu;

template <typename T, typename U> std::istream&operator>>(std::istream&i, pair<T,U>&p) {i >> p.x >> p.y; return i;}
template<typename T>std::istream&operator>>(std::istream&i,vector<T>&t) {for(auto&v:t){i>>v;}return i;}
template <typename T, typename U> std::ostream&operator<<(std::ostream&o, const pair<T,U>&p) {o << p.x << ' ' << p.y; return o;}
template<typename T>std::ostream&operator<<(std::ostream&o,const vector<T>&t) {if(t.empty())o<<'\n';for(size_t i=0;i<t.size();++i){o<<t[i]<<" \n"[i == t.size()-1];}return o;}
template<typename T> using minheap = priority_queue<T, vector<T>, greater<T>>;
template<typename T> using maxheap = priority_queue<T, vector<T>, less<T>>;
template <typename T> bool in(T a, T b, T c) { return a <= b && b < c; }
ui logceil(int x) { return 8*sizeof(int)-__builtin_clz(x); }

namespace std { template<typename T,typename U>struct hash<pair<T,U>>{hash<T>t;hash<U>u;size_t operator()(const pair<T,U>&p)const{return t(p.x)^(u(p.y)<<7);}}; }
template<typename T,typename F>T bsh(T l,T h,const F&f){T r=-1,m;while(l<=h){m=(l+h)/2;if(f(m)){l=m+1;r=m;}else{h=m-1;}}return r;}
template<typename F> double bshd(double l,double h,const F&f,double p=1e-9){ui r=3+(ui)log2((h-l)/p);while(r--){double m=(l+h)/2;if(f(m)){l=m;}else{h=m;}}return (l+h)/2;}
template<typename T,typename F>T bsl(T l,T h,const F&f){T r=-1,m;while(l<=h){m=(l+h)/2;if(f(m)){h=m-1;r=m;}else{l=m+1;}}return r;}
template<typename F> double bsld(double l,double h,const F&f,double p=1e-9){ui r=3+(ui)log2((h-l)/p);while(r--){double m=(l+h)/2;if(f(m)){h=m;}else{l=m;}}return (l+h)/2;}
template<typename T> T gcd(T a,T b) { if (a<b) swap(a,b); return b?gcd(b,a%b):a; }

template<typename T>class vector2:public vector<vector<T>>{public:vector2(){} vector2(size_t a,size_t b,T t=T()):vector<vector<T>>(a,vector<T>(b,t)){}};
template<typename T>class vector3:public vector<vector2<T>>{public:vector3(){} vector3(size_t a,size_t b,size_t c,T t=T()):vector<vector2<T>>(a,vector2<T>(b,c,t)){}};
template<typename T>class vector4:public vector<vector3<T>>{public:vector4(){} vector4(size_t a,size_t b,size_t c,size_t d,T t=T()):vector<vector3<T>>(a,vector3<T>(b,c,d,t)){}};
template<typename T>class vector5:public vector<vector4<T>>{public:vector5(){} vector5(size_t a,size_t b,size_t c,size_t d,size_t e,T t=T()):vector<vector4<T>>(a,vector4<T>(b,c,d,e,t)){}};

#endif
// #include "../l/mod.h"

class caseofatopsecret {
public:
    void solve(istream& cin, ostream& cout) {
        int N,M; cin >> N >> M;
        vector<pii> Y(N);
        for (int i = 0; i < N; ++i) {
            cin >> Y[i].x;
            Y[i].y = i;
        }
        sort(Y.begin(),Y.end());
        vector<int> X(N), T(N), R(N);
        for (int i = 0; i < N; ++i) {
            X[i] = Y[i].x;
            T[i] = Y[i].y+1;
            R[Y[i].y] = i;
        }

        for (int i = 0; i < M; ++i) {
            int A, L; cin >> A >> L;
            A = R[A-1];
            int P = X[A];

            while (true) {
                int prevA = A;
                int prevL = L;

                auto it = prev(upper_bound(X.begin(), X.end(), P + L));
                if (*it == P) {
                    cout << T[A] << '\n';
                    break;
                }

                L = L - (*it - P);
                P = *it;
                A = distance(X.begin(), it);
//                cout << "swing right " << A << ' ' << L << endl;

                it = lower_bound(X.begin(), X.end(), P - L);
                if (*it == P) {
                    cout << T[A] << '\n';
                    break;
                }

                L = L - (P - *it);
                P = *it;
                A = distance(X.begin(), it);

//                cout << "swing left " << A << ' ' << L << endl;

                if (prevA == A && 2*L >= prevL) {
//                    cout << "reduction " << prevL - L << ' ' << L << "->" << L%(prevL-L) << endl;
                    L %= (prevL-L);
                }

                prevA = A;
                prevL = L;
            }
        }
    }
};

int main() {
	ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
	caseofatopsecret solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
    return 0;
}


/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author majk
 */

#ifndef MAJK_LIB
#define MAJK_LIB

#include <vector>
#include <stack>
#include <iostream>
#include <unordered_map>
#include <unordered_set>
#include <map>
#include <iomanip>
#include <set>
#include <functional>
#include <fstream>
#include <algorithm>
#include <cassert>
#include <cmath>
#include <string>
#include <sstream>
#include <queue>
#include <bitset>
using namespace std;

#define x first
#define y second
typedef std::pair<int,int> pii; typedef long long ll; typedef unsigned long long ull; typedef unsigned int ui; typedef pair<ui,ui> puu;

template <typename T, typename U> std::istream&operator>>(std::istream&i, pair<T,U>&p) {i >> p.x >> p.y; return i;}
template<typename T>std::istream&operator>>(std::istream&i,vector<T>&t) {for(auto&v:t){i>>v;}return i;}
template <typename T, typename U> std::ostream&operator<<(std::ostream&o, const pair<T,U>&p) {o << p.x << ' ' << p.y; return o;}
template<typename T>std::ostream&operator<<(std::ostream&o,const vector<T>&t) {if(t.empty())o<<'\n';for(size_t i=0;i<t.size();++i){o<<t[i]<<" \n"[i == t.size()-1];}return o;}
template<typename T> using minheap = priority_queue<T, vector<T>, greater<T>>;
template<typename T> using maxheap = priority_queue<T, vector<T>, less<T>>;
template <typename T> bool in(T a, T b, T c) { return a <= b && b < c; }
ui logceil(int x) { return 8*sizeof(int)-__builtin_clz(x); }

namespace std { template<typename T,typename U>struct hash<pair<T,U>>{hash<T>t;hash<U>u;size_t operator()(const pair<T,U>&p)const{return t(p.x)^(u(p.y)<<7);}}; }
template<typename T,typename F>T bsh(T l,T h,const F&f){T r=-1,m;while(l<=h){m=(l+h)/2;if(f(m)){l=m+1;r=m;}else{h=m-1;}}return r;}
template<typename F> double bshd(double l,double h,const F&f,double p=1e-9){ui r=3+(ui)log2((h-l)/p);while(r--){double m=(l+h)/2;if(f(m)){l=m;}else{h=m;}}return (l+h)/2;}
template<typename T,typename F>T bsl(T l,T h,const F&f){T r=-1,m;while(l<=h){m=(l+h)/2;if(f(m)){h=m-1;r=m;}else{l=m+1;}}return r;}
template<typename F> double bsld(double l,double h,const F&f,double p=1e-9){ui r=3+(ui)log2((h-l)/p);while(r--){double m=(l+h)/2;if(f(m)){h=m;}else{l=m;}}return (l+h)/2;}
template<typename T> T gcd(T a,T b) { if (a<b) swap(a,b); return b?gcd(b,a%b):a; }

template<typename T>class vector2:public vector<vector<T>>{public:vector2(){} vector2(size_t a,size_t b,T t=T()):vector<vector<T>>(a,vector<T>(b,t)){}};
template<typename T>class vector3:public vector<vector2<T>>{public:vector3(){} vector3(size_t a,size_t b,size_t c,T t=T()):vector<vector2<T>>(a,vector2<T>(b,c,t)){}};
template<typename T>class vector4:public vector<vector3<T>>{public:vector4(){} vector4(size_t a,size_t b,size_t c,size_t d,T t=T()):vector<vector3<T>>(a,vector3<T>(b,c,d,t)){}};
template<typename T>class vector5:public vector<vector4<T>>{public:vector5(){} vector5(size_t a,size_t b,size_t c,size_t d,size_t e,T t=T()):vector<vector4<T>>(a,vector4<T>(b,c,d,e,t)){}};

#endif
// #include "../l/mod.h"

class caseofatopsecret {
public:
    void solve(istream& cin, ostream& cout) {
        int N,M; cin >> N >> M;
        vector<pii> Y(N);
        for (int i = 0; i < N; ++i) {
            cin >> Y[i].x;
            Y[i].y = i;
        }
        sort(Y.begin(),Y.end());
        vector<int> X(N), T(N), R(N);
        for (int i = 0; i < N; ++i) {
            X[i] = Y[i].x;
            T[i] = Y[i].y+1;
            R[Y[i].y] = i;
        }

        for (int i = 0; i < M; ++i) {
            int A, L; cin >> A >> L;
            A = R[A-1];
            int P = X[A];

            while (true) {
                int prevA = A;
                int prevL = L;

                auto it = prev(upper_bound(X.begin(), X.end(), P + L));
                L = L - (*it - P);
                P = *it;
                A = distance(X.begin(), it);

                it = lower_bound(X.begin(), X.end(), P - L);
                L = L - (P - *it);
                P = *it;
                A = distance(X.begin(), it);

                if (prevA == A) {
                    if (L == prevL) {
                        cout << T[A] << '\n';
                        break;
                    } else if (2*L >= prevL) {
                        L %= (prevL - L);
                    }
                }

                prevA = A;
                prevL = L;
            }
        }
    }
};

int main() {
	ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
	caseofatopsecret solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
    return 0;
}


/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author majk
 */

#ifndef MAJK_LIB
#define MAJK_LIB

#include <vector>
#include <stack>
#include <iostream>
#include <unordered_map>
#include <unordered_set>
#include <map>
#include <iomanip>
#include <set>
#include <functional>
#include <fstream>
#include <algorithm>
#include <cassert>
#include <cmath>
#include <string>
#include <sstream>
#include <queue>
#include <bitset>
using namespace std;

#define x first
#define y second
typedef std::pair<int,int> pii; typedef long long ll; typedef unsigned long long ull; typedef unsigned int ui; typedef pair<ui,ui> puu;

template <typename T, typename U> std::istream&operator>>(std::istream&i, pair<T,U>&p) {i >> p.x >> p.y; return i;}
template<typename T>std::istream&operator>>(std::istream&i,vector<T>&t) {for(auto&v:t){i>>v;}return i;}
template <typename T, typename U> std::ostream&operator<<(std::ostream&o, const pair<T,U>&p) {o << p.x << ' ' << p.y; return o;}
template<typename T>std::ostream&operator<<(std::ostream&o,const vector<T>&t) {if(t.empty())o<<'\n';for(size_t i=0;i<t.size();++i){o<<t[i]<<" \n"[i == t.size()-1];}return o;}
template<typename T> using minheap = priority_queue<T, vector<T>, greater<T>>;
template<typename T> using maxheap = priority_queue<T, vector<T>, less<T>>;
template <typename T> bool in(T a, T b, T c) { return a <= b && b < c; }
ui logceil(int x) { return 8*sizeof(int)-__builtin_clz(x); }

namespace std { template<typename T,typename U>struct hash<pair<T,U>>{hash<T>t;hash<U>u;size_t operator()(const pair<T,U>&p)const{return t(p.x)^(u(p.y)<<7);}}; }
template<typename T,typename F>T bsh(T l,T h,const F&f){T r=-1,m;while(l<=h){m=(l+h)/2;if(f(m)){l=m+1;r=m;}else{h=m-1;}}return r;}
template<typename F> double bshd(double l,double h,const F&f,double p=1e-9){ui r=3+(ui)log2((h-l)/p);while(r--){double m=(l+h)/2;if(f(m)){l=m;}else{h=m;}}return (l+h)/2;}
template<typename T,typename F>T bsl(T l,T h,const F&f){T r=-1,m;while(l<=h){m=(l+h)/2;if(f(m)){h=m-1;r=m;}else{l=m+1;}}return r;}
template<typename F> double bsld(double l,double h,const F&f,double p=1e-9){ui r=3+(ui)log2((h-l)/p);while(r--){double m=(l+h)/2;if(f(m)){h=m;}else{l=m;}}return (l+h)/2;}
template<typename T> T gcd(T a,T b) { if (a<b) swap(a,b); return b?gcd(b,a%b):a; }

template<typename T>class vector2:public vector<vector<T>>{public:vector2(){} vector2(size_t a,size_t b,T t=T()):vector<vector<T>>(a,vector<T>(b,t)){}};
template<typename T>class vector3:public vector<vector2<T>>{public:vector3(){} vector3(size_t a,size_t b,size_t c,T t=T()):vector<vector2<T>>(a,vector2<T>(b,c,t)){}};
template<typename T>class vector4:public vector<vector3<T>>{public:vector4(){} vector4(size_t a,size_t b,size_t c,size_t d,T t=T()):vector<vector3<T>>(a,vector3<T>(b,c,d,t)){}};
template<typename T>class vector5:public vector<vector4<T>>{public:vector5(){} vector5(size_t a,size_t b,size_t c,size_t d,size_t e,T t=T()):vector<vector4<T>>(a,vector4<T>(b,c,d,e,t)){}};

#endif
// #include "../l/mod.h"

class caseofatopsecret {
public:
    void solve(istream& cin, ostream& cout) {
        int N,M; cin >> N >> M;
        vector<int> X(N); cin >> X;
        for (int i = 0; i < M; ++i) {
            int A, L; cin >> A >> L;
            int P = X[A-1];

            while (true) {
                int prevA = A;
                int prevL = L;

                auto it = prev(upper_bound(X.begin(), X.end(), P + L));
                if (*it == P) {
                    cout << A + 1 << '\n';
                    break;
                }

                L = L - (*it - P);
                P = *it;
                A = distance(X.begin(), it);
//                cout << "swing right " << A << ' ' << L << endl;

                it = lower_bound(X.begin(), X.end(), P - L);
                if (*it == P) {
                    cout << A + 1 << '\n';
                    break;
                }

                L = L - (P - *it);
                P = *it;
                A = distance(X.begin(), it);

//                cout << "swing left " << A << ' ' << L << endl;

                if (prevA == A && 2*L >= prevL) {
//                    cout << "reduction " << prevL - L << ' ' << L << "->" << L%(prevL-L) << endl;
                    L %= (prevL-L);
                }

                prevA = A;
                prevL = L;
            }
        }
    }
};

int main() {
	ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
	caseofatopsecret solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
    return 0;
}