#t482. 开关灯

开关灯

Lights On and Off

Problem Description

Suppose there are NN lights (NN is a positive integer not greater than 50005000), numbered 11 to NN in order, all initially turned on; and there are MM people (MM is a positive integer not greater than NN), also numbered 11 to MM in order.

Person 11 turns all the lights off. Person 22 turns on the lights whose numbers are multiples of 22. Person 33 flips the lights whose numbers are multiples of 33 (i.e. turns on the ones that are off, and turns off the ones that are on). In increasing order of number, everyone after that behaves like person 33: each flips all the lights whose numbers are multiples of their own number.

After person MM has finished operating, which lights are off? Output their numbers in increasing order, separated by commas.

Input Format

Two positive integers NN and MM, separated by a single space.

Output Format

Output the numbers of the lights that are off, in order, separated by commas.

Sample Input

10 10

Sample Output

1,4,9

Hint

  • A light ends up off if it is flipped an odd number of times. Think about which positions are flipped an odd number of times.
  • The output uses a comma , (not a space) to separate the numbers — check against the sample character by character.