If the M&A team is based within an investment bank then my view is that is not permissible as you are then part of an overall institution that is fundamentally doing a whole bunch of things that are not sharia-compliant.
If the M&A team is part of an advisory boutique such as Lazards or Pirella Weinberg, I would be comfortable with that.
As stated in other FAQs, whether you are assisting the client with an analysis around debt projections etc. is of itself not impermissible. However, if you can guide your career towards sectors where cash buyouts are more likely, that’s helpful. Or, if your team is set up around functions, if you can guide your career to work in the function that puts the deal together and does the initial research rather than the team that sorts out the financing model, that would be much better. From conversations with friends in investment banking, this is generally somewhat possible. See also this guest article from an investment banker.