#include <bits/stdc++.h>
const int mod = 1e9 + 7;
const int MAXN = 1e5 + 10;
using namespace std;
long long vis[25];
long long a[MAXN];
vector<pair<long long, int> > vec[MAXN];
long long ans[MAXN];
long long ksm(int m) {
  long long ans1 = 1;
  long long t = 2;
  while (m) {
    if (m & 1) ans1 = ans1 * t % mod;
    m = m >> 1;
    t = t * t % mod;
  }
  return ans1;
}
int main() {
  ios::sync_with_stdio(false);
  int n, m, l;
  long long x;
  cin >> n >> m;
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int i = 1; i <= m; i++) {
    cin >> l >> x;
    vec[l].push_back(make_pair(x, i));
  }
  int cnt = 0;
  memset(ans, 0, sizeof(ans));
  for (int i = 1; i <= n; i++) {
    for (int j = 20; j >= 0; j--) {
      if ((a[i] & (1 << j))) {
        if (vis[j])
          a[i] ^= vis[j];
        else {
          vis[j] = a[i];
          break;
        }
      }
    }
    if (a[i] == 0) cnt++;
    for (int j = 0; j < vec[i].size(); j++) {
      x = vec[i][j].first;
      bool flag = 0;
      for (int k = 20; k >= 0; k--) {
        if ((x & (1 << k))) {
          if (vis[k])
            x ^= vis[k];
          else {
            flag = 1;
            break;
          }
        }
      }
      if (!flag) ans[vec[i][j].second] = ksm(cnt);
    }
  }
  for (int i = 1; i <= m; i++) cout << ans[i] << endl;
  return 0;
}
