Error join database to SQL availability group
It seems like you don't have permission to the folder M:\UserLogs\. 

Try the below method, it may be help you.


Grant full access to SQL server service account for M:\UserLogs. (Which must be a domain account)
Manually restore the database.
While adding the db to AG choose JOIN ONLY.