Out-of-Distribution Generalization with Maximal Invariant Predictor