#include #include using namespace atcoder; using namespace std; #define modulo 1000000007 #define mod(mod_x) ((((long long)mod_x+modulo))%modulo) #define Inf 100000000000000000 void Func(vector &A){ int last = 0; for(long long i=31;i>=0;i--){ int ind = -1; for(int j=last;j>i) & 1LL){ ind = j; break; swap(A[j],A[last]); ind = last; last++; break; } } if(ind==-1)continue; for(int j=0;j>i)&1LL){ A[j] ^= A[ind]; } } } swap(A[last],A[ind]); last++; } while(A.size()!=0&&A.back()==0)A.pop_back(); return; } vector op(vector A,vector B){ while(B.size()>0){ A.push_back(B.back()); B.pop_back(); } Func(A); return A; } vector e(){ return vector(0); } int beki(long long a,long long b,int M = modulo){ int x = 1; while(b!=0){ if(b&1){ x=((long long)x*a)%M; } a=((long long)a*a)%M; b>>=1; } return x; } int main(){ int N,Q; cin>>N>>Q; vector> A(N); for(int i=0;i>t; A[i] = {t}; } segtree,op,e> S(A); for(int i=0;i>M; vector B(M); for(int j=0;j>B[j]; int ans = 1; for(int j=0;j<=M;j++){ int l,r; if(j!=0)l = B[j-1]; else l=0; if(j!=M)r = B[j]; else r=N; int t = S.prod(l,r).size(); ans = mod(ans * beki(2,r-l-t)); } cout<