The first thing you should do after your M.2 SSD fails is recover important data from the drive. Using a data recovery solution should work in most cases as long as the computer can read the data on the M.2 SSD drive. Once you've recovered the data, try to identify the cause of the failure. Causes can include logical errors like file system corruption or virus infection, or physical damage. Logical errors are easier to fix, but if your M.2 SSD is physically damaged, the odds repairing the drive are lower.