I am looking for a polynomialtime algorithm that takes as input a bipartite graph, and returns one of two options:

If a perfect matching exists, it returns the matching;

Otherwise, it returns an “evidence” that a perfect matching does not exist, based on Hall’s theorem, i.e., it returns a set $ X$ such that the number of neighbors of $ X$ is smaller than $ X$ .
I found in wikipedia various algorithms for finding a maximum matching in an unweighted bipartite graph. Such algorithms can be used to determine if a perfect matching exists. But does any of these algorithms also return an evidence in case of failure?