This page is still under construction.

Parts of this page are still being built. What you see may change.

Baby Hongyoon

Interview

Time limit1sMemory limit1024 MB

Summary
Find a contiguous subarray whose bitwise OR equals K, or report that none exists.
Level

Medium6 of 10

Topics
Bit manipulation, Two pointers, Array, Sliding window
Solved
No attempts yet

Problem

Hongyoon likes intervals. Hongyoon also likes bitwise operators. So he made a problem that combines intervals and bitwise operators.

Given an array AA of size NN, find an interval of consecutive elements whose bitwise or equals exactly KK. If there are several such intervals, you may choose any one of them.

Input

The first line gives NN and KK. (1≤N≤200,0001 \leq N \leq 200,000, 1≤K≤230−11 \leq K \leq 2^{30}-1)

The second line gives the array AA of length NN. (1≤Ai≤230−11 \leq A_i \leq 2^{30}-1)

Output

If the interval from the ss-th to the ee-th number from the left satisfies the condition, print ss and ee separated by a space on one line. If no such interval exists, print -1 instead.

Examples2

  1. Example 1

    Input
    5 7
    8 1 2 5 9
    
    Expected output
    2 4
    
  2. Example 2

    Input
    5 6
    2 7 4 1 4
    
    Expected output
    -1