#include <bits/stdc++.h>
using namespace std;
int n, m;
int a[200000];
void run(int casenr) {
  scanf("%d%d", &n, &m);
  for (int i = (0); i < (n); ++i) scanf("%d", &a[i]);
  int cntpos = 0, cntneg = 0;
  for (int i = (0); i < (n); ++i)
    if (a[i] < 0)
      ++cntneg;
    else
      ++cntpos;
  for (int i = (0); i < (m); ++i) {
    int l, r;
    scanf("%d%d", &l, &r);
    int cnt = r - l + 1;
    printf("%d\n",
           cnt % 2 == 0 && cntpos >= cnt / 2 && cntneg >= cnt / 2 ? 1 : 0);
  }
}
int main() {
  run(1);
  return 0;
}
