The answer that zteffi gave is almost right. This is the documented function definition from https://docs.opencv.org/4.x/da/d54/group__imgproc__transform.html
cv.warpPerspective(src, M, dsize[, dst[, flags[, borderMode[, borderValue]]]]) -> dst
Notice that "flags" is only included if the "dst" argument is included? You need to include a dst argument for the flag cv2.WARP_INVERSE_MAP to be at the right position in the call.
Now, I don't see anything particularly interesting in that dst value after a call (it does not appear to be the requested value -- the return value of the function is). You can simply code "None" for dst:
transformed_points = cv2.warpPerspective(p_array, matrix, (2,1), None, cv2.WARP_INVERSE_MAP)