#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
int a[100005], res[100005];
vector<pair<int, int> > dp[100005];
int vec[20];
int main() {
  int n, q;
  scanf("%d%d", &n, &q);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  for (int i = 1; i <= q; i++) {
    int l, x;
    scanf("%d%d", &l, &x);
    dp[l].push_back(pair<int, int>(x, i));
  }
  memset(vec, -1, sizeof(vec));
  int ans = 1;
  for (int i = 1; i <= n; i++) {
    bool ok = 1;
    for (int j = 19; j >= 0; j--) {
      if ((a[i] >> j) & 1) {
        if (vec[j] == -1) {
          vec[j] = a[i];
          ok = 0;
          break;
        } else {
          a[i] ^= vec[j];
        }
      }
    }
    if (ok) ans = ans * 2 % mod;
    for (int j = 0; j < dp[i].size(); j++) {
      int x = dp[i][j].first, idx = dp[i][j].second;
      bool ok = 1;
      for (int j = 19; j >= 0; j--) {
        if ((x >> j) & 1) {
          if (vec[j] == -1) {
            ok = 0;
            break;
          } else {
            x ^= vec[j];
          }
        }
      }
      if (ok) res[idx] = ans;
    }
  }
  for (int i = 1; i <= q; i++) printf("%d\n", res[i]);
}
