#include using namespace std; #define rep(i,n) for(int i=0;i<(int)(n);i++) #define rrep(i,n) for(int i=(int)(n-1);i>=0;i--) #define ALL(v) v.begin(),v.end() #define RALL(v) v.rbegin(),v.rend() template using V=vector; template using VV=V>; using u128=__int128_t; using ll=long long; int main(){ ios::sync_with_stdio(false); std::cin.tie(nullptr); int n,q; cin>>n>>q; V A(n); rep(i,n) cin>>A[i]; VV B(26,V(n)),S(26,V(n+1)); rep(i,n){ rep(j,26){ if((A[i]&(1<>l>>r; l--; ll ans=0; rep(j,26){ ll c1=S[j][r]-S[j][l]; ll c0=r-l-c1; ans+=c0*c1*(1<