Study of J/psi pi+ pi- states produced in B0 ---> J / psi pi+ pi- K0 and B- ---> J / psi pi+ pi- K-