See Sparse A\B
To do this efficiently you’ll may need to think carefully about your particular problem as I noted above.