Under construction

Still being built. Things may change

N-interesting Numbers

Time limit5sMemory limit512 MB

Summary
Given N and n, find the n-th largest number X whose largest prime factor p is at most 127 and satisfies p^k at most N, where k counts the prime factors.
Level

Medium7 of 10

Topics
Backtracking, Number theory, Sorting
Solved
No attempts yet

Statement

An integer X≥2X \ge 2 is called NN-interesting if, in its prime factorization X=p1p2⋯pkX=p_1p_2\cdots p_k, the largest factor pip_i satisfies pik≤Np_i^k \le N and pi≤127p_i \le 127.

You are given two integers NN and nn. It is guaranteed that at least nn NN-interesting numbers exist and that there are finitely many of them. Find the nn-th largest NN-interesting number.

Input

The first line contains two integers NN and nn (2≤N≤10182 \le N \le 10^{18}; 1≤n≤8⋅1051 \le n \le 8 \cdot 10^5).

Output

Print one integer: the nn-th largest NN-interesting number.

Examples1

  1. Example 1

    Input
    3110 21
    
    Expected output
    1573