#include<bits/stdc++.h>
using namespace std;
int n,q,a[300005],seg[1200005];
void build (int l,int r,int id){
	if (l==r) seg[id]=a[l];
	else {
		int mid=l+(r-l)/2;
		build(l,mid,id*2);
		build (mid+1,r,id*2+1);
		seg[id]=seg[id*2]^seg[id*2+1];
	}
}
void change(int p,int val,int l,int r,int id){
	if (l>p||r<p) return;
	seg[id]^=val;
	if (l==r) {
		return;
	}
	int mid=l+(r-l)/2;
	change(p,val,l,mid,id*2);
	change(p,val,mid+1,r,id*2+1);
}
int get(int l,int r,int curl,int curr,int id){
	if (l>curr||curl>r) return 0;
	if (curl>=l&&curr<=r) return seg[id];
	int mid=curl+(curr-curl)/2;
	return get(l,r,curl,mid,id*2)^get(l,r,mid+1,curr,id*2+1);
}
int main () {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cin>>n>>q;
	for (int i=0;i<n;i++) cin>>a[i];
	build(0,n-1,1);
	for (int i=0;i<q;i++){
		int type;
		cin>>type;
		if (type==1){
			int x,y;
			cin>>x>>y;
			change(x-1,y,0,n-1,1);
			a[x-1]^=y;
		}
		else {
			int x,y;
			cin>>x>>y;
			cout<<get(x-1,y-1,0,n-1,1)<<'\n';
		}
	}
}

#include <bits/stdc++.h>
//#include <chrono>
#pragma GCC optimize("O3")
using namespace std;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define Rreps(i,n,e) for(int i = n - 1; i >= e; --i)
#define Rrep(i,n) Rreps(i,n,0)
#define ALL(a) a.begin(), a.end()

using ll = long long;
using vec = vector<ll>;
using mat = vector<vec>;

ll N,M,H,W,Q,K,A,B;
string S;
using P = pair<ll, ll>;
const ll INF = (1LL<<60);

template<class T> bool chmin(T &a, const T &b){
    if(a > b) {a = b; return true;}
    else return false;
}
template<class T> bool chmax(T &a, const T &b){
    if(a < b) {a = b; return true;}
    else return false;
}
template<class T> void print_vector(std::vector<T> v,bool endline = true){
    if(!v.empty()){
        for(std::size_t i{}; i<v.size()-1; ++i) std::cout<<v[i]<<" ";
        std::cout<<v.back();
    }
    if(endline) std::cout<<std::endl;
}

void no(){cout<<-1<<endl; exit(0);}

template <unsigned long long mod > class modint{
public:
    ll x;
    constexpr modint(){x = 0;}
    constexpr modint(ll _x) : x((_x < 0 ? ((_x += (LLONG_MAX / mod) * mod) < 0 ? _x + (LLONG_MAX / mod) * mod : _x) : _x)%mod){}
    constexpr modint set_raw(ll _x){
        //_x in [0, mod)
        x = _x;
        return *this;
    }
    constexpr modint operator-(){
        return x == 0 ? 0 : mod - x;
    }
    constexpr modint& operator+=(const modint& a){
        if((x += a.x) >= mod) x -= mod;
        return *this;
    }
    constexpr modint operator+(const modint& a) const{
        return modint(*this) += a;
    }
    constexpr modint& operator-=(const modint& a){
        if((x -= a.x) < 0) x += mod;
        return *this;
    }
    constexpr modint operator-(const modint& a) const{
        return modint(*this) -= a;
    }
    constexpr modint& operator*=(const modint& a){
        (x *= a.x)%=mod;
        return *this;
    }
    constexpr modint operator*(const modint& a) const{
        return modint(*this) *= a;
    }
    constexpr modint pow(unsigned long long pw) const{
        modint res(1), comp(*this);
        while(pw){
            if(pw&1) res *= comp;
            comp *= comp;
            pw >>= 1;
        }
        return res;
    }
    //以下、modが素数のときのみ
    constexpr modint inv() const{
        if(x == 2) return (mod + 1) >> 1;
        return modint(*this).pow(mod - 2);
    }
    constexpr modint& operator/=(const modint &a){
        (x *= a.inv().x)%=mod;
        return *this;
    }
    constexpr modint operator/(const modint &a) const{
        return modint(*this) /= a;
    }
};
#define mod2 1000000007
using mint = modint<mod2>;

ostream& operator<<(ostream& os, const mint& a){
    os << a.x;
    return os;
}
using vm = vector<mint>;

mint cmb(int n, int m){
    mint res(1);
    rep(i, m)(res *= n - i) /= i + 1;
    return res;
}

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cin>>N>>M;
    vec a(N);
    rep(i, N) cin>>a[i];
    ll sum = accumulate(ALL(a), 0);
    cout<<cmb(M + N, sum + N)<<endl;
}
