// NOTE: it is recommended to use this even if you don't understand the following code.

#include <assert.h>
#include <stdio.h>
#include <stdlib.h>

#define MAXN 200001
#define MAXQ 200001

int N, Q, i, j;
int V[MAXN];
int queries[MAXQ][2];
int cost[MAXQ];

int main() {
    // uncomment the two following lines if you want to read/write from files
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);

    assert(2 == scanf("%d%d", &N, &Q));

    for (i = 1; i <= N; ++i)
        assert(1 == scanf("%d", &V[i]));

    for (j = 1; j <= Q; ++j) {
        for (i = 0; i < 2; ++i)
            assert(1 == scanf("%d", &queries[j][i]));
    }



    // INSERT YOUR CODE HERE


    for (i = 1; i <= Q; ++i)
        printf("%d\n", cost[i]);

    return 0;
}
