#include <bits/stdc++.h>
using namespace std;
long long int gmatrix[100009][64];
long long int basis[100009];
void add(long long int x, long long int index) {
  basis[index] = basis[index - 1];
  for (long long int i = 19; i >= 0; i--) {
    gmatrix[index][i] = gmatrix[index - 1][i];
  }
  for (long long int i = 19; i >= 0; i--) {
    if (x & (1 << i)) {
      if (gmatrix[index][i])
        x ^= gmatrix[index][i];
      else {
        gmatrix[index][i] = x;
        basis[index]++;
        return;
      }
    }
  }
}
bool check(long long int x, long long int index) {
  for (long long int i = 19; i >= 0; i--) {
    if (x & (1 << i)) {
      if (gmatrix[index][i])
        x ^= gmatrix[index][i];
      else
        return 0;
    }
  }
  return 1;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int n, q;
  cin >> n >> q;
  long long int ans[q];
  long long int x, y;
  long long int p[n + 1];
  p[0] = 1;
  for (long long int i = 1; i <= n; i++) {
    cin >> x;
    add(x, i);
    p[i] = (p[i - 1] * 2) % 1000000007;
  }
  for (long long int i = 0; i < q; i++) {
    cin >> y >> x;
    if (check(x, y))
      cout << p[y - basis[y]] << '\n';
    else
      cout << 0 << '\n';
  }
}
