Cari nomor dalam 2D ​​diurutkan

def find_in_sorted_mat(mat, N,M,find_element):
    for k in range(len(find_element)):
        X = find_element[k]
        notFound = True
        R = M-1
        L = 0
        while L>-1 and R>-1 and L<N and R<M:
            if mat[L][R] == X:
                print(L,R)
                notFound = False
                break
            elif mat[L][R]>X:
                R = R-1
            else:
                L = L+1
        if notFound:
            print(-1)
Mayank Dubey