#include<bits/stdc++.h>
using namespace std;
int N,Q,r,l;
long long s,niz[200005];
int main() {
    ios_base::sync_with_stdio(false);
    //freopen("hacking.in","r",stdin);
    //freopen("hacking.out","w",stdout);
    cin>>N>>Q;
    for(int i=1;i<=N;i++) {
        cin>>niz[i];
    }
    for(int j=1;j<=Q;j++) {
        cin>>l>>r;
        cout<<s<<endl;
    }
    return 0;
}