#include <bits/stdc++.h>
using namespace std;
pair<int, int> basis[21];
vector<int> basisv;
int n, a, l, x, q;
const int md = 1e9 + 7;
uint64_t powmod(int pw) {
  uint64_t ans = 1;
  uint64_t bs = 2;
  while (pw) {
    if (pw & 1) {
      ans *= bs;
      ans %= md;
    }
    pw >>= 1;
    bs *= bs;
    bs %= md;
  }
  return ans;
}
int main() {
  scanf("%d%d", &n, &q);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a);
    for (int j = 20; j >= 0; j--) {
      if (a & (1 << j)) {
        if (basis[j].first) {
          a ^= basis[j].second;
        } else {
          basis[j] = {i, a};
          basisv.push_back(i);
          break;
        }
      }
    }
  }
  bool ok = true;
  for (int i = 0; i < q; i++) {
    scanf("%d%d", &l, &x);
    ok = true;
    for (int j = 20; j >= 0; j--) {
      if (x & (1 << j)) {
        if (basis[j].first && basis[j].first <= l)
          x ^= basis[j].second;
        else {
          ok = false;
          break;
        }
      }
    }
    if (!ok) {
      puts("0");
      continue;
    }
    int sz = lower_bound(basisv.begin(), basisv.end(), l) - basisv.begin();
    if (sz == basisv.size() || basisv[sz] > l) sz--;
    printf("%llu\n", powmod(l - sz - 1));
  }
}
