#include <iostream>
using namespace std;

int main(){
	int m, n, ans;
	while(cin>>m>>n, m!=0&&n!=0){
		ans=1;
		for(int i=2; i<=m; i++){
			ans = (ans+n)%i;
			if(ans==0)ans=i;
			cout << ans << endl;
		}
		cout<<ans<<"\n";
	}
	return 0;
}