Measurement of long-range multi-particle azimuthal correlations with the subevent cumulant method in pp and p+Pb collisions with the ATLAS detector at the LHC