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

#include <fstream>
#include <iostream>
#include <string>
#include <vector>

using namespace std;

int main() {
    // uncomment the two following lines if you want to read/write from files
    // ifstream cin("input.txt");
    // ofstream cout("output.txt");

    int N, Q;
    cin >> N >> Q;

    vector<int> V(N + 1);
    for (int i = 1; i <= N; ++i)
        cin >> V[i];

    vector<vector<int>> queries(Q + 1, vector<int>(2));
    for (int j = 1; j <= Q; ++j) {
        for (int i = 0; i < 2; ++i)
            cin >> queries[j][i];
    }

    vector<int> cost(Q + 1);


    // INSERT YOUR CODE HERE


    for (int i = 1; i <= Q; ++i)
        cout << cost[i] << "\n";

    return 0;
}
