#include using namespace std; using ll = long long; ll R,N; vector A; ll f(ll X){ ll res=(X/R)*N; X%=R; res+=upper_bound(A.begin(),A.end(),X)-A.begin(); return res; } int main() { cin.tie(nullptr); ios::sync_with_stdio(false); cin>>R>>N; A.resize(N); for(int i=0;i>A[i]; sort(A.begin(),A.end()); ll Q; cin>>Q; for(int q=0;q>l>>r; cout<