#include <bits/stdc++.h>
using namespace std;

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie();
	unsigned long long N, Q; cin >> N >> Q;
	unsigned long long A[N];
	for (int i = 0; i < N; i++){
		cin >> A[i];
	}
	while(Q--){
		double L, R; cin >> L >> R;
		cout << floor(log2(R-L)+1) << '\n';
	}
	


return 0;
}