#include <bits/stdc++.h>

using namespace std;

/*
if(used[to]) low[v]=min(low[v],tin[to])
else{
    dfs(to,v);
    low[v]=min(low[v],low[to]);

    if(low[to]>tin[v]) rebro;
}*/
#define ll long long
const ll F=1e18,N=5e5+3;
ll n,a[N];

ll suf[N],pr[N];




void ans(){
    ll L,R;
    cin>>L>>R;

    if(L%2==0) L++;
    if(R%2==0) R--;

    cout<<R-L+1<<"\n";
}

int main()
{
    ll q,t;
    cin>>n>>q;
    for(ll i=1;i<=n;++i) cin>>a[i];
    a[0]=-1e18;
    a[n+1]=-1e18;




    while(q--){
        cin>>t;

        ans();
    }
}
