#include <iostream>

using namespace std;

int main() {
    int a[5001] = {0}, n, m;//把数组初始化为0, 0为关, 1为开;
    cin>>n>>m;
    for (int i = 2; i <= m; i++) {//通过循环控制灯的开关
            for (int j = 1; j <= n; j++) {
                if (j % i == 0) {
                    if(a[j] == 0) a[j] = 1;
                    else a[j] = 0;
                }
            } 
    }
    int t = 0;//引入t控制‘,’输出
    for(int i = 1; i <= n; i++) {
        if(a[i] == 0) t++;
    }
    for(int i = 1; i <= n; i++) {
        if(a[i] == 0) {
            t--;
            if(t != 0) cout<<i<<',';
            else cout<<i;
        }
    }
}