#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
const long long MAX = LONG_LONG_MAX;
const double pi = 3.1415926535897932384626433832;
const long long M = 1e9 + 7;
long long modpow(long long x, long long n, long long mod1) {
  if (n == 0) return 1 % mod1;
  long long u = modpow(x, n / 2, mod1);
  u = (u * u) % mod1;
  if (n % 2 == 1) u = (u * x) % mod1;
  return u;
}
long long POW(long long x, long long y) { return modpow(x, y, LONG_LONG_MAX); }
long long MI(long long x, long long mod = M) { return modpow(x, mod - 2, mod); }
long long gcd(long long x, long long y) {
  if (x == 0)
    return y;
  else
    return gcd(y % x, x);
}
long long lcm(long long x, long long y) { return (x * y) / gcd(x, y); }
bool isPrime(long long n) {
  if (n <= 1) return false;
  if (n <= 3) return true;
  if (n % 2 == 0 || n % 3 == 0) return false;
  for (long long i = 5; i * i <= n; i = i + 6) {
    if (n % i == 0 || n % (i + 2) == 0) {
      return false;
    }
  }
  return true;
}
long long sumdigits(long long a) {
  long long result = 0;
  while (a > 0) {
    result += a % 10;
    a /= 10;
  }
  return result;
}
const long long Node = 2e5 + 7;
vector<long long> adj[Node];
int vis[Node];
int vis1[Node];
void addedge(long long u, long long v) {
  adj[u - 1].push_back(v - 1);
  adj[v - 1].push_back(u - 1);
}
void solve() {
  long long n, k;
  cin >> n >> k;
  vector<long long> v;
  for (long long i = 1; i < (long long)sqrt(n) + 1; i++) {
    if (n % i == 0) {
      if (n != i * i) {
        v.push_back(i);
        v.push_back(n / i);
      } else {
        v.push_back(i);
      }
    }
  }
  sort(v.begin(), v.end());
  if (v.size() < k) {
    cout << -1 << endl;
    return;
  }
  cout << v[k - 1] << endl;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  long long t = 1;
  while (t--) {
    solve();
  }
  return 0;
}

### Prompt

Develop a solution in Cpp to the problem described below:

You are given two integers n and k. Find k-th smallest divisor of n, or report that it doesn't exist.

Divisor of n is any such natural number, that n can be divided by it without remainder.

Input

The first line contains two integers n and k (1 ≤ n ≤ 1015, 1 ≤ k ≤ 109).

Output

If n has less than k divisors, output -1.

Otherwise, output the k-th smallest divisor of n.

Examples

Input

4 2


Output

2


Input

5 3


Output

-1


Input

12 5


Output

6

Note

In the first example, number 4 has three divisors: 1, 2 and 4. The second one is 2.

In the second example, number 5 has only two divisors: 1 and 5. The third divisor doesn't exist, so the answer is -1.

### Response

```cpp
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
const long long MAX = LONG_LONG_MAX;
const double pi = 3.1415926535897932384626433832;
const long long M = 1e9 + 7;
long long modpow(long long x, long long n, long long mod1) {
  if (n == 0) return 1 % mod1;
  long long u = modpow(x, n / 2, mod1);
  u = (u * u) % mod1;
  if (n % 2 == 1) u = (u * x) % mod1;
  return u;
}
long long POW(long long x, long long y) { return modpow(x, y, LONG_LONG_MAX); }
long long MI(long long x, long long mod = M) { return modpow(x, mod - 2, mod); }
long long gcd(long long x, long long y) {
  if (x == 0)
    return y;
  else
    return gcd(y % x, x);
}
long long lcm(long long x, long long y) { return (x * y) / gcd(x, y); }
bool isPrime(long long n) {
  if (n <= 1) return false;
  if (n <= 3) return true;
  if (n % 2 == 0 || n % 3 == 0) return false;
  for (long long i = 5; i * i <= n; i = i + 6) {
    if (n % i == 0 || n % (i + 2) == 0) {
      return false;
    }
  }
  return true;
}
long long sumdigits(long long a) {
  long long result = 0;
  while (a > 0) {
    result += a % 10;
    a /= 10;
  }
  return result;
}
const long long Node = 2e5 + 7;
vector<long long> adj[Node];
int vis[Node];
int vis1[Node];
void addedge(long long u, long long v) {
  adj[u - 1].push_back(v - 1);
  adj[v - 1].push_back(u - 1);
}
void solve() {
  long long n, k;
  cin >> n >> k;
  vector<long long> v;
  for (long long i = 1; i < (long long)sqrt(n) + 1; i++) {
    if (n % i == 0) {
      if (n != i * i) {
        v.push_back(i);
        v.push_back(n / i);
      } else {
        v.push_back(i);
      }
    }
  }
  sort(v.begin(), v.end());
  if (v.size() < k) {
    cout << -1 << endl;
    return;
  }
  cout << v[k - 1] << endl;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  long long t = 1;
  while (t--) {
    solve();
  }
  return 0;
}

```