```python
def sort_matrix(M):
    """
    Sorts a matrix in ascending order according to the sum of its rows.

    Args:
        M: A list of lists of numbers (matrix).

    Returns:
        A new matrix with rows sorted by their sum.
    """
    return sorted(M, key=sum)

```