Technically, you're right. What i mean to ask though is how many times will he pick up a piece.
Note: When a piece does not fit, he puts it back into the pile and may pick it up again immediately. If so, it still counts as picking up another piece.
The solution I found is recursive. I have closed forms for m=1 and m=2. I'm still working on generalizing it.