import java.util.Scanner; public class Main{ public static void main(String[] args){ Scanner scanner = new Scanner(System.in); int num = scanner.nextInt(); int bits = scanner.nextInt(); StringBuilder sb = new StringBuilder(); int index = 1; while(index <= bits){ sb.insert(0, num % 10); num /= 10; index++; } System.out.print(sb.toString()); } }