Winter in Yekaterinburg is the longest time of the year. And everyone
spends long winter evenings in his own way. Kate regularly travels with her
friends to the nearest ski resort — mountain Spilnaya — to go
snowboarding. There is just opened a new track. But while Kate’s first ride
on this track she felt deja vu, as if she has already ridden on exactly
the same slope. Well, maybe a little sharper or flatter. She was so
excited that instead of one more ride, she decided to check up, whether
there were some sections of the slopes, where she was riding earlier, that
were similar to the slope, which she has just moved out. Returning to her
car and taking out the laptop, Kate found on the Internet detailed information
on all the slopes she rode, including the new track on Spilnaya.
This information corresponds to the map of heights in increments of one
meter. Kate considers similar two sections of different slopes of the same
length, if for the heights of the first section x_{0}, x_{1}, …, x_{n}
and for the heights of the second section y_{0}, y_{1}, …, y_{n} and
some numbers a and b, the equality x_{i} − y_{i} = a · i + b is correct.
Input
The first line contains an integer n that is the number of slopes where
Kate rode earlier (1 ≤ n ≤ 10^{5}). The second line
contains an integer m, and integers x_{0} … x_{m}, where m is the
length of the slope, which Kate just moved out, and x_{i} is the height
above sea level of a point which is in the i metres from the start of
the slope (1 ≤ m ≤ 10^{5}; −10^{9} ≤ x_{i} ≤
10^{9}). The next n lines describe all slopes, where Kate rode earlier.
It is guaranteed that the sum of their lengths does not exceed 10^{5}.
Output
If there are such numbers i and j that the slope which Kate just moved
out is similar to the section, starting with the jth meter from the
beginning of the ith slope of those where she rode earlier, output
numbers i and j separated with a space. The slopes are numbered with
integers from 1 to n in the order in which they appear in the input
data. If there are several matching pairs i and j, output the one
with the minimal absolute value of a parameter of the similarity
criterion. If there are still multiple solutions, output any of them. If
these numbers do not exist, output −1.
Samples
input  output 

2
2 3 2 1
5 21 15 10 6 3 2
4 10 7 5 3 2
 2 1

3
2 0 0 0
1 0 0
2 1 2 4
1 5 17
 1

Problem Author: Dmitry Ivankov
Problem Source: Open Ural FU Personal Contest 2014