#include <bits/stdc++.h>
using namespace std;
struct query {
  int id, l, x, ans;
} qrs[100009];
bool idcomp(query a, query b) { return a.id < b.id; }
bool lcomp(query a, query b) { return a.l < b.l; }
int N, Q, a[100009], killer[20];
int modExp(int a, int b) {
  if (b == 0) return 1;
  int c = modExp(a, b >> 1);
  c = (c * 1ll * c) % 1000000007;
  if (b & 1) c = (c * 1ll * a) % 1000000007;
  return c;
}
int main() {
  scanf("%d %d", &N, &Q);
  memset(&killer, -1, sizeof killer);
  for (int i = 0; i < N; i++) {
    scanf("%d", &a[i]);
  }
  for (int q = 0; q < Q; q++) {
    scanf("%d %d", &qrs[q].l, &qrs[q].x);
    qrs[q].id = q;
    qrs[q].l--;
  }
  sort(qrs, qrs + Q, lcomp);
  int q = 0, nz = 0;
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < 20; j++) {
      if (killer[j] != -1 && (a[i] & 1 << j)) {
        a[i] ^= a[killer[j]];
      }
    }
    for (int j = 0; j < 20; j++) {
      if (killer[j] == -1 && (a[i] & 1 << j)) {
        killer[j] = i;
        for (int it = 0; it < i; it++) {
          if ((a[it] & 1 << j)) a[it] ^= a[i];
        }
        break;
      }
    }
    if (a[i] == 0) nz++;
    while (q < Q && qrs[q].l < i) q++;
    while (q < Q && qrs[q].l == i) {
      int x = qrs[q].x;
      for (int j = 0; j < 20; j++) {
        if (killer[j] != -1 && (x & 1 << j)) {
          x ^= a[killer[j]];
        }
      }
      if (x == 0)
        qrs[q].ans = modExp(2, nz);
      else
        qrs[q].ans = 0;
      q++;
    }
  }
  sort(qrs, qrs + Q, idcomp);
  for (int q = 0; q < Q; q++) {
    printf("%d\n", qrs[q].ans);
  }
  return 0;
}
