#include #include #include #include using namespace std; int main() { int n,q; cin >> n >> q; vectora(n); mapdict; for(int i=0;i> a[i]; { vectorb=a; sort(b.begin(),b.end()); for(int i=0;i> x >> y; cout << max(0,dict[a[x-1]]-dict[a[y-1]]-1) << endl; } }