#include <bits/stdc++.h>
using namespace std;
long long i, j, k, l, n, m;
vector<long long> a[200009];
long long mpow(long long n, long long m) {
  long long res = 1, curr = n;
  while (m) {
    if (m & 1) res = (res * curr) % 1000000007;
    curr = (curr * curr) % 1000000007;
    m /= 2;
  }
  return res;
}
int main() {
  ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  cin >> n >> m;
  for (i = 1; i <= n; i++) {
    a[i] = a[i - 1];
    cin >> k;
    for (auto to : a[i]) {
      k = min(k, k ^ to);
    }
    if (k) a[i].push_back(k);
  }
  while (m--) {
    cin >> k >> l;
    for (auto to : a[k]) l = min(l, l ^ to);
    if (l != 0)
      cout << 0 << '\n';
    else
      cout << mpow(2, k - a[k].size()) << '\n';
  }
  exit(0);
}
