#include <bits/stdc++.h>
using namespace std;
const int MOD = (int)1e9 + 7;
const int INF = (int)1e9 + 9;
const int MX = (int)1e5 + 5;
struct XorBasis {
  int loga = 20;
  vector<int> basis;
  int sz;
  XorBasis() {
    basis.resize(loga, 0);
    sz = 0;
  }
  void insertVector(int mask) {
    for (int i = 0; i < loga; i++) {
      if ((mask & 1 << i) == 0) continue;
      if (!basis[i]) {
        basis[i] = mask;
        sz++;
        break;
      }
      mask ^= basis[i];
    }
  }
  bool isXorPos(int mask) {
    for (int i = 0; i < loga; i++) {
      if ((mask & 1 << i) == 0) continue;
      if (!basis[i]) return false;
      mask ^= basis[i];
    }
    return true;
  }
};
int n;
int inp[MX];
int q;
pair<int, int> q_data[MX];
vector<int> q_at[MX];
int ans[MX];
int powers[MX];
void aux() {
  powers[0] = 1;
  for (int i = 1; i < MX; i++) powers[i] = (powers[i - 1] * 2LL) % MOD;
}
int main() {
  aux();
  cin >> n >> q;
  for (int i = 1; i <= n; i++) {
    cin >> inp[i];
  }
  int l, x;
  for (int i = 1; i <= q; i++) {
    cin >> l >> x;
    q_data[i] = {l, x};
    q_at[l].push_back(i);
  }
  XorBasis xb;
  for (int i = 1; i <= n; i++) {
    xb.insertVector(inp[i]);
    for (auto j : q_at[i]) {
      int l = q_data[j].first;
      int x = q_data[j].second;
      if (xb.isXorPos(x)) {
        int nonBasisVec = l - xb.sz;
        ans[j] = powers[nonBasisVec];
      }
    }
  }
  for (int i = 1; i <= q; i++) {
    cout << ans[i] << endl;
  }
  return 0;
}
