Find distinct elements common to all rows of a matrix