It sounds like you were cut out of the lottery. IIRC, visa lotteries have to be issued by Sept. 30. Past that date, your lottery status is reset and you have to re-apply for the next lottery.
I-130's take about a year to approve.
Because your wife is a permanent resident and not a citizen, your category is F2A. That category has numerical limitations and you need to wait for a visa number to be available. An approved I-130 does not automatically give you a visa number.
You cannot remain in the US with an approved I-130. You can only remain if you qualify to adjust status. You cannot adjust status until a F2A visa number becomes available. If you overstay your M1 visa, you will automatically be disqualified from adjusting status.
You can return to your country and apply for a B2 visa to visit before your M1 expires. There is no guarantee it will be approved. If it is approved, you can visit for up to 6 months, at the discretion of CBP. You can only visit - you cannot work, even remotely. If an F2A visa number becomes available while you are legally visiting with the B2, you can adjust status, depending on what you stated to CBP when you entered on your B2. For example, if CBP ask if you are planning to stay and adjust status, and you said No, they can used that to deny your adjustment.