#include<stdio.h>
int main() {
	int N;
	int E;
	while(scanf("%d%d", &N, &E) == 2) {
		if(N == 0 && E == 0) break;
		int total = N*E;
		int i = 1, cur = total, cost = N;
		while(cur > 0) {
			if(cost > 0) {
				cur -= cost;
				cost = N - (total-cur)/E;
			}
			i += 1;
		}
		printf("%d\n", i-1);
	}
	return 0;
}