#include<bits/stdc++.h>
using namespace std;
int main() {
	bool a[5005] = {};
	int n,m;
	cin >> n >> m;
	for (int i = 2 ;i <= m; ++i) {
		for (int j = 1;j <= n; ++j) {
			if (j % i == 0) {
				if (a[j]){
					a[j] = false;
				}else {
					a[j] = true;
				}
			} 
		}
	}
	bool t = true;
	for (int i = 1; i <= n; i++) {
		if (a[i] == false){
		    if (t) {
			    t = false;
		    }
		    else {
			    cout << ",";
		    }
		    cout << i;
		}
	}  
	return 0;
}