Amayama is a collector of diamonds. Today he is invited to a party with his group.

For each participant in this party, he or she would receive a prize code which consists of m integers. For a group of participants, if all the people in this group have a **continuous section** of integers with length k in his or her prize code, and everyone in the group is able to convert own **continuous section** to any others' in the group by adding the same integer to every integer in own **continuous section**, then we call the group get a k-level diamond.

There are n people in Amayama's group and he wants to know which level of diamond can they get.

The first line of input contains two integer n, m. (1<=n<=1000,1<=m<=100)

The following are n lines, and each line containing m integers standing the prize code that a member in Amayama's team gets.

The output contains an integer k, which stands the level of diamond the group gets.

For the example, the continuous part for each prize code is:

2 3

5 6

-9 -8 (or 1 2)

100 101 (or 101 102)

5 6 (or 6 7)