#include <stdio.h>

int main() {
	int x = 0;
	int i = 0;
	scanf("%d %d", &x, &i);
	i = pow(10, i);
	x = x % i;
	printf("%d", x);
	return 0;
}