Try the following formula for M10 and copy down the column.
Only rows where the B column is not blank will be included in the search array.
Edit to add an explanation.
Note that the MATCH function will only return the index of the first match found in the search array, it has no way to determine that you want to skip the first match because it doesn’t have a value in column B. The IF function added above will evalauate as an array result where the rows that B is blank will have a blank row in the array result.