#include <bits/stdc++.h>
using namespace std;
int a[2 * (int)(1e5) + 5];
int main() {
  cin.sync_with_stdio(false);
  int n, m, neg, poz, x, y;
  cin >> n >> m;
  neg = poz = 0;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    if (a[i] < 0)
      neg++;
    else
      poz++;
  }
  for (int i = 1; i <= m; i++) {
    cin >> x >> y;
    if ((y - x + 1) % 2 == 1)
      cout << "0\n";
    else if ((y - x + 1) / 2 <= poz && (y - x + 1) / 2 <= neg)
      cout << "1\n";
    else
      cout << "0\n";
  }
  return 0;
}
