#include <bits/stdc++.h>
using namespace std;
set<long long> cac;
long long n, q;
vector<pair<long long, long long> > query[100005];
long long a[100005];
long long ans[100005];
queue<long long> temp;
signed main() {
  cin >> n >> q;
  for (long long i = 1; i <= n; i++) {
    cin >> a[i];
  }
  for (long long i = 1; i <= q; i++) {
    long long l, x;
    cin >> l >> x;
    query[l].push_back({x, i});
  }
  long long get = 1;
  cac.insert(0);
  for (long long i = 1; i <= n; i++) {
    if (!cac.count(a[i])) {
      for (auto j : cac) {
        temp.push(a[i] ^ j);
      }
      while (temp.size()) {
        cac.insert(temp.front());
        temp.pop();
      }
    } else {
      get = get * 2;
      get %= 1000000007;
    }
    for (auto ii : query[i]) {
      if (cac.count(ii.first)) {
        ans[ii.second] = get;
      }
    }
  }
  for (long long i = 1; i <= q; i++) {
    cout << ans[i] << endl;
  }
}
