minimum = A(0,0)
min_N = 0
min_M = 0
For i=0 to N-1
For j=0 to M-1
If minimum > A(i,j) Then
minimum = A(i,j)
min_N = i
min_M = j
end if
Next j
Next i
For i = 0 to N-1
A(i, min_M) = 0
Next i
For i = 0 to M-1
A(min_N, i) = 0
Next i