#include <bits/stdc++.h>
using namespace std;
struct LB {
  long long a[100], size, n;
  void copy(LB x) {
    memcpy(a, x.a, sizeof(a));
    size = x.size;
    n = x.n + 1;
  }
  void init() { memset(a, 0, sizeof(a)); }
  void insert(long long x) {
    long long i;
    for (i = 63; i >= 0; i--)
      if (x & (1ll << i)) {
        if (!a[i]) {
          a[i] = x;
          ++size;
          return;
        }
        x ^= a[i];
      }
  }
  bool in(int x) {
    register int i;
    for (i = 63; i >= 0; i--)
      if (x & (1ll << i)) {
        if (!a[i]) return 0;
        x ^= a[i];
      }
    return 1;
  }
} lb[100010];
int num[100010];
int N, m;
const long long mod = 1e9 + 7;
long long ksm(int y) {
  long long x = 2ll, ret = 1ll;
  while (y) {
    if (y & 1) ret = ret * x % mod;
    x = x * x % mod;
    y >>= 1;
  }
  return ret;
}
int main() {
  int i, x, y;
  scanf("%d %d", &N, &m);
  for (i = 1; i <= N; i++) {
    lb[i].copy(lb[i - 1]);
    scanf("%d", &x);
    lb[i].insert(x);
  }
  while (m--) {
    scanf("%d %d", &x, &y);
    if (lb[x].in(y))
      cout << ksm(x - lb[x].size) << '\n';
    else
      puts("0");
  }
}
