Every time you touch 1~5, if A touches X, B can take 6-X, ensuring that the sum of each round is 6. So if the total number of pieces is an integer multiple of 6, the person who takes it later wins. If it is not an integer multiple of 6, the person who gets it first wins, because he can get the remainder of the total divided by 6, thus ensuring that the rest of the pieces are multiples of 6.