#include <bits/stdc++.h>
using namespace std;
int n, q;
int A[100010];
vector<pair<int, int> > vq[100010];
int ans[100010];
int p2[100010];
int main() {
  p2[0] = 1;
  for (int i = int(1); i < int(100010); i++) p2[i] = p2[i - 1] * 2 % 1000000007;
  scanf("%d%d", &n, &q);
  for (int i = int(1); i < int(n + 1); i++) scanf("%d", A + i);
  for (int i = 0; i < q; i++) {
    int l, x;
    scanf("%d%d", &l, &x);
    vq[l].push_back(pair<int, int>(x, i));
  }
  int f[20];
  memset(f, -1, sizeof f);
  int z = 0;
  for (int i = int(1); i < int(n + 1); i++) {
    int a = A[i];
    int sePuede = -1;
    for (int j = 19; j >= 0; j--) {
      if (1 << j & a) {
        if (f[j] == -1) {
          sePuede = j;
          break;
        } else
          a ^= f[j];
      }
    }
    if (sePuede == -1)
      ++z;
    else
      f[sePuede] = a;
    for (pair<int, int> e : vq[i]) {
      int x = e.first;
      for (int j = 19; j >= 0; j--) {
        if (1 << j & x) {
          if (f[j] == -1) break;
          x ^= f[j];
        }
      }
      ans[e.second] = (x == 0 ? p2[z] : 0);
    }
  }
  for (int i = int(0); i < int(q); i++) printf("%d\n", ans[i]);
  return 0;
}
