Method of distributions for two-phase flow in heterogeneous porous media