You are given matrix *a* of size *n* × *m*, its elements are integers. We will assume that the rows of the matrix are numbered from top to bottom from 1 to *n*, the columns are numbered from left to right from 1 to *m*. We will denote the element on the intersecting of the *i*-th row and the *j*-th column as *a*<sub class="lower-index">*ij*</sub>.

We'll call submatrix *i*<sub class="lower-index">1</sub>, *j*<sub class="lower-index">1</sub>, *i*<sub class="lower-index">2</sub>, *j*<sub class="lower-index">2</sub> (1 ≤ *i*<sub class="lower-index">1</sub> ≤ *i*<sub class="lower-index">2</sub> ≤ *n*; 1 ≤ *j*<sub class="lower-index">1</sub> ≤ *j*<sub class="lower-index">2</sub> ≤ *m*) such elements *a*<sub class="lower-index">*ij*</sub> of the given matrix that *i*<sub class="lower-index">1</sub> ≤ *i* ≤ *i*<sub class="lower-index">2</sub> AND *j*<sub class="lower-index">1</sub> ≤ *j* ≤ *j*<sub class="lower-index">2</sub>. We'll call the area of the submatrix number (*i*<sub class="lower-index">2</sub> - *i*<sub class="lower-index">1</sub> + 1)·(*j*<sub class="lower-index">2</sub> - *j*<sub class="lower-index">1</sub> + 1). We'll call a submatrix inhomogeneous, if all its elements are distinct.

Find the largest (in area) inhomogenous submatrix of the given matrix.
The first line contains two integers *n*, *m* (1 ≤ *n*, *m* ≤ 400) — the number of rows and columns of the matrix, correspondingly.

Each of the next *n* lines contains *m* integers *a*<sub class="lower-index">*ij*</sub> (1 ≤ *a*<sub class="lower-index">*ij*</sub> ≤ 160000) — the elements of the matrix.
## row : 0 ~ N-1, column : 0 ~ M-1

num = list(map(int, input().split()))
N = num[0]
M = num[1]
mat = [list(map(int, input().split())) for _ in range(N)]
can_start = [[[0,0] for j in range(M)] for i in range(N)]
res = [[0 for j in range(M)] for i in range(N)]
def prep() :
    for i in range(N) :
        elem = dict()
        first = 0
        for j in range(M) :
            if mat[i][j] in elem.keys() :
                can_start[i][j][0] = max(first, elem[mat[i][j]] + 1)
                first = max(first, elem[mat[i][j]] + 1)
            else :
                can_start[i][j][0] = first
            elem[mat[i][j]] = j

    for j in range(M) :
        elem = dict()
        first = 0
        for i in range(N) :
            if mat[i][j] in elem.keys() :
                can_start[i][j][1] = max(first, elem[mat[i][j]] + 1)
                first = max(first, elem[mat[i][j]] + 1)
            elem[mat[i][j]] = i

def check(i1, j1, i2, j2) :
    a = set()
    for i in range(i1, i2 + 1):
        for j in range(j1, j2 + 1):
            if mat[i][j] in a :
                return 0
            else :
                a.add(mat[i][j])
    return (i2 - i1 + 1) * (j2 - j1 + 1)

def find(i, j) :
    if res[i][j] != 0 :
        return res[i][j]

    if i == 0 and j == 0 :
        res[i][j] = 1
        return 1

    elif i == 0 :
        tot = 2
        tot_set = set([mat[i][j]])
        for idx in range(j-2, -1, -1):
            if mat[i][idx] in tot_set:
                break
            else:
                tot = tot + 1
                tot_set.add(mat[i][idx])
        res[i][j] = max(find(i, j-1), tot)
        return res[i][j]

    elif j == 0 :
        tot = 2
        tot_set = set([mat[i][j]])
        for idx in range(i-2, -1, -1):
            if mat[idx][j] in tot_set:
                break
            else:
                tot = tot + 1
                tot_set.add(mat[idx][j])
        res[i][j] = max(find(i-1, j), tot)
        return res[i][j]

    # include mat[i][j]

    else :
        tot = 0
        for a in range(can_start[i][j][0], i + 1) :
            for b in range(can_start[i][j][1], j + 1):
                tot = max(tot, check(b, a, i, j))

        res[i][j] =  max(find(i, j-1), find(i-1, j), tot)
        return res[i][j]

prep()
print(find(N-1, M-1))