A binned Dalitz plot analysis of $B^pm to D K^pm$ decays, with $D to K^0_{rm S} pi^+pi^-$ and $D to K^0_{rm S} K^+ K^-$, is performed to measure the CP-violating observables $x_{pm}$ and $y_{pm}$ which are sensitive to the CKM angle $gamma$. The analysis exploits 1.0 $rm fb^{-1}$ of data collected by the LHCb experiment. The study makes no model-based assumption on the variation of the strong phase of the D decay amplitude over the Dalitz plot, but uses measurements of this quantity from CLEO-c as input. The values of the parameters are found to be $x_- = (0.0 pm 4.3 pm 1.5 pm 0.6) times 10^{-2}$, $y_- = (2.7 pm 5.2 pm 0.8 pm 2.3) times 10^{-2}$, $x_+ = (-10.3 pm 4.5 pm 1.8 pm 1.4)times 10^{-2}$ and $y_+ = (-0.9 pm 3.7 pm 0.8 pm 3.0)times 10^{-2}$. The first, second, and third uncertainties are the statistical, the experimental systematic, and the error associated with the precision of the strong-phase parameters measured at CLEO-c, respectively. These results correspond to $gamma = (44^{,+43}_{,-38})^circ$, with a second solution at $gamma to gamma + 180^circ$, and $r_B = 0.07 pm 0.04$, where $r_B$ is the ratio between the suppressed and favoured B decay amplitudes.