/*
PROBLEM: C2
LANG: C
NAME: Svilen Marchev
SCHOOL: 12 SOU, Sofia
*/

#include <stdio.h>
#include <math.h>

#define MAXP	100000
#define PRIME	1
#define NOT_SET	-1

int proizv[MAXP];
int p, k;

void input()
{
	//freopen("c2.in", "r", stdin);
	scanf("%d %d", &p, &k);
}

int getMnoj(int n)	// vryshta ediniq mnojitel ili PRIME
{
	int i = 2;
	if (n == 2) return PRIME;
	while (i <= sqrt(n)) {
		if (n % i == 0)
			return i;
		i++;
	}
	return PRIME;
}

int get(int n)
{
	int a, b, res = 0;

	if (n == 1) return 0;
	else if ((a = getMnoj(n)) == PRIME) return 1;
	else {
		//a = getMnoj(n);
		b = n / a;
		if (proizv[a] == NOT_SET) proizv[a] = get(a);
		if (proizv[b] == NOT_SET) proizv[b] = get(b);
		//res = a * get(b) + get(a) * b;
		res = a * proizv[b] + proizv[a] * b;
		return res;
	}
}

void solve()
{
	int i, new_num, old_num;

	for (i = 0; i < MAXP; i++) proizv[i] = NOT_SET;

	old_num = p;
	for (i = 0; i < k; i++) {
		new_num = get(old_num);
		old_num = new_num;
	}
	printf("%d\n", new_num);
}

int main()
{
	input();
	solve();
	return 0;
}