Problem: 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.

Solution (in JAVA):

Solution:
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.io.BufferedWriter;
import java.util.Collection;
import java.util.Random;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Jialin Ouyang (Jialin.Ouyang@gmail.com)
 */
public class Main {
  public static void main(String[] args) {
    InputStream inputStream = System.in;
    OutputStream outputStream = System.out;
    QuickScanner in = new QuickScanner(inputStream);
    QuickWriter out = new QuickWriter(outputStream);
    TaskA solver = new TaskA();
    solver.solve(1, in, out);
    out.close();
  }

  static class TaskA {
    public void solve(int testNumber, QuickScanner in, QuickWriter out) {
      long n = in.nextLong();
      LongArrayList divisors = new LongArrayList(30000);
      LongUtils.divisors(n, divisors);
//System.out.printf("divisors(%d):%s\n", divisors.size, divisors);
      int k = in.nextInt();
      out.println(k <= divisors.size ? divisors.kth(k - 1) : -1);
    }

  }

  static class LongModular {
    public static long fix(long a, long mod) {
      a = slightFix(a, mod);
      return 0 <= a && a < mod ? a : slightFix(a % mod, mod);
    }

    public static long add(long a, long b, long mod) {
      return slightFix(fix(a, mod) + fix(b, mod), mod);
    }

    public static long mul(long a, long b, long mod) {
      a = fix(a, mod);
      b = fix(b, mod);
      long res = 0;
      for (; b > 0; b >>= 1, a = add(a, a, mod))
        if ((b & 1) > 0) {
          res = add(res, a, mod);
        }
      return res;
    }

    public static long pow(long a, long b, long mod) {
      a = fix(a, mod);
      long res = 1;
      for (; b > 0; b >>= 1, a = mul(a, a, mod))
        if ((b & 1) > 0) {
          res = mul(res, a, mod);
        }
      return res < mod ? res : fix(res, mod);
    }

    private static long slightFix(long a, long mod) {
      return a >= mod
          ? a - mod
          : a < 0 ? a + mod : a;
    }

  }

  static class IntUtils {
    public static boolean isPow2(int n) {
      return n > 0 && (n & (n - 1)) == 0;
    }

    public static int nextPow2(int n) {
      if (n < 1) return 1;
      return isPow2(n) ? n : Integer.highestOneBit(n) << 1;
    }

  }

  static class QuickScanner {
    private static final int BUFFER_SIZE = 1024;
    private InputStream stream;
    private byte[] buffer;
    private int currentPosition;
    private int numberOfChars;

    public QuickScanner(InputStream stream) {
      this.stream = stream;
      this.buffer = new byte[BUFFER_SIZE];
      this.currentPosition = 0;
      this.numberOfChars = 0;
    }

    public int nextInt() {
      int c = nextNonSpaceChar();
      boolean positive = true;
      if (c == '-') {
        positive = false;
        c = nextChar();
      }
      int res = 0;
      do {
        if (c < '0' || '9' < c) throw new RuntimeException();
        res = res * 10 + c - '0';
        c = nextChar();
      } while (!isSpaceChar(c));
      return positive ? res : -res;
    }

    public long nextLong() {
      int c = nextNonSpaceChar();
      boolean positive = true;
      if (c == '-') {
        positive = false;
        c = nextChar();
      }
      long res = 0;
      do {
        if (c < '0' || '9' < c) throw new RuntimeException();
        res = res * 10 + c - '0';
        c = nextChar();
      } while (!isSpaceChar(c));
      return positive ? res : -res;
    }

    public int nextNonSpaceChar() {
      int res = nextChar();
      for (; isSpaceChar(res) || res < 0; res = nextChar()) ;
      return res;
    }

    public int nextChar() {
      if (numberOfChars == -1) {
        throw new RuntimeException();
      }
      if (currentPosition >= numberOfChars) {
        currentPosition = 0;
        try {
          numberOfChars = stream.read(buffer);
        } catch (Exception e) {
          throw new RuntimeException(e);
        }
        if (numberOfChars <= 0) {
          return -1;
        }
      }
      return buffer[currentPosition++];
    }

    public boolean isSpaceChar(int c) {
      return c == ' ' || c == '\t' || isEndOfLineChar(c);
    }

    public boolean isEndOfLineChar(int c) {
      return c == '\n' || c == '\r' || c < 0;
    }

  }

  static interface IntCollection {
  }

  static class QuickWriter {
    private final PrintWriter writer;

    public QuickWriter(OutputStream outputStream) {
      this.writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
    }

    public QuickWriter(Writer writer) {
      this.writer = new PrintWriter(writer);
    }

    public void print(Object... objects) {
      for (int i = 0; i < objects.length; ++i) {
        if (i > 0) {
          writer.print(' ');
        }
        writer.print(objects[i]);
      }
    }

    public void println(Object... objects) {
      print(objects);
      writer.print('\n');
    }

    public void close() {
      writer.close();
    }

  }

  static class IntArrayUtils {
    public static String toString(int[] values, int fromIdx, int toIdx) {
      StringBuilder sb = new StringBuilder("[");
      for (int i = fromIdx; i < toIdx; ++i) {
        if (i != fromIdx) sb.append(", ");
        sb.append(values[i]);
      }
      return sb.append("]").toString();
    }

  }

  static class LongArrayList implements LongCollection {
    private static final long[] EMPTY = {};
    public long[] values;
    public int size;

    public LongArrayList() {
      values = EMPTY;
      clear();
    }

    public LongArrayList(int capacity) {
      values = new long[IntUtils.nextPow2(capacity)];
      clear();
    }

    public LongArrayList(Collection<Long> collection) {
      this(collection.size());
      addAll(collection);
    }


    public void clear() {
      size = 0;
    }


    public void add(long value) {
      ensureCapacity(size + 1);
      addInternal(value);
    }


    public void addAll(Collection<Long> values) {
      ensureCapacity(size + values.size());
      for (long value : values) {
        addInternal(value);
      }
    }

    public long get(int idx) {
      if (idx >= size) throw new ArrayIndexOutOfBoundsException();
      return values[idx];
    }

    public void sort() {
      LongArrayUtils.sort(values, 0, size);
    }

    public void unique(IntArrayList cnt) {
      cnt.clear();
      cnt.ensureCapacity(size);
      int newSize = LongArrayUtils.unique(values, 0, size, cnt.values, 0);
      size = cnt.size = newSize;
    }

    public void sortAndUnique(IntArrayList cnt) {
      sort();
      unique(cnt);
    }

    public long kth(int kth) {
      return LongArrayUtils.kth(values, 0, size, kth);
    }


    public String toString() {
      return LongArrayUtils.toString(values, 0, size);
    }

    public void ensureCapacity(int capacity) {
      if (capacity <= values.length) return;
      long[] newValues = new long[IntUtils.nextPow2(capacity)];
      for (int i = 0; i < size; ++i) {
        newValues[i] = values[i];
      }
      values = newValues;
    }

    private void addInternal(long value) {
      values[size++] = value;
    }

  }

  static class IntArrayList implements IntCollection {
    private static final int[] EMPTY = {};
    public int[] values;
    public int size;

    public IntArrayList() {
      values = EMPTY;
      clear();
    }

    public IntArrayList(int capacity) {
      values = new int[IntUtils.nextPow2(capacity)];
      clear();
    }

    public IntArrayList(Collection<Integer> collection) {
      this(collection.size());
      addAll(collection);
    }


    public void clear() {
      size = 0;
    }


    public void addAll(Collection<Integer> values) {
      ensureCapacity(size + values.size());
      for (int value : values) {
        addInternal(value);
      }
    }

    public int get(int idx) {
      if (idx >= size) throw new ArrayIndexOutOfBoundsException();
      return values[idx];
    }


    public String toString() {
      return IntArrayUtils.toString(values, 0, size);
    }

    public void ensureCapacity(int capacity) {
      if (capacity <= values.length) return;
      int[] newValues = new int[IntUtils.nextPow2(capacity)];
      for (int i = 0; i < size; ++i) {
        newValues[i] = values[i];
      }
      values = newValues;
    }

    private void addInternal(int value) {
      values[size++] = value;
    }

  }

  static class LongArrayUtils {
    private static final Random RANDOM = new Random(1000000007);

    public static void sort(long[] values, int fromIdx, int toIdx) {
      shuffle(values, fromIdx, toIdx);
      Arrays.sort(values, fromIdx, toIdx);
    }

    public static int unique(long[] values, int fromIdx, int toIdx, int[] cnt, int startIdx) {
      if (fromIdx == toIdx) return 0;
      int res = 1;
      cnt[startIdx] = 1;
      for (int i = fromIdx + 1; i < toIdx; ++i) {
        if (values[i - 1] != values[i]) {
          values[fromIdx + res++] = values[i];
          cnt[++startIdx] = 1;
        } else {
          ++cnt[startIdx];
        }
      }
      return res;
    }

    public static void swap(long[] values, int uIdx, int vIdx) {
      if (uIdx == vIdx) return;
      values[uIdx] ^= values[vIdx];
      values[vIdx] ^= values[uIdx];
      values[uIdx] ^= values[vIdx];
    }

    public static void shuffle(long[] values, int fromIdx, int toIdx) {
      for (int i = toIdx - fromIdx - 1; i > 0; --i) {
        swap(values, i + fromIdx, RANDOM.nextInt(i + 1) + fromIdx);
      }
    }

    public static long kth(long[] values, int fromIdx, int toIdx, int kth) {
      return kthInternal(values, fromIdx, toIdx - 1, kth);
    }

    public static String toString(long[] values, int fromIdx, int toIdx) {
      StringBuilder sb = new StringBuilder("[");
      for (int i = fromIdx; i < toIdx; ++i) {
        if (i != fromIdx) sb.append(", ");
        sb.append(values[i]);
      }
      return sb.append("]").toString();
    }

    private static long kthInternal(long[] values, int lower, int upper, int kth) {
      if (lower == upper) return values[lower];
      if (lower + 1 == upper) {
        if (values[lower] > values[lower + 1]) swap(values, lower, lower + 1);
        return kth > 0 ? values[lower + 1] : values[lower];
      }
      long pivot = values[lower + RANDOM.nextInt(upper - lower)];
      int i = lower, j = upper;
      while (i <= j) {
        for (; values[i] < pivot; ++i) {
        }
        for (; values[j] > pivot; --j) {
        }
        if (i <= j) swap(values, i++, j--);
      }
      return kth < i - lower
          ? kthInternal(values, lower, i - 1, kth)
          : kthInternal(values, i, upper, kth - i + lower);
    }

  }

  static class LongUtils {
    private static final int[] PRIMES = new int[]{2, 3, 5, 7, 11, 13, 17, 19, 23};
    private static final Random RANDOM = new Random(1000000000000000003L);
    private static final int MAX_PRIME = 64;
    private static final LongArrayList P = new LongArrayList(MAX_PRIME);
    private static final IntArrayList R = new IntArrayList(MAX_PRIME);

    public static boolean isPrime(long n) {
      if (n <= 1 || (n > 2 && (n & 1) == 0)) return false;
      int s = Long.numberOfTrailingZeros(n - 1);
      long d = (n - 1) >> s;
      for (int i = 0; i < PRIMES.length && PRIMES[i] < n; ++i) {
        long x = LongModular.pow(PRIMES[i], d, n);
        if (x == 1) continue;
        int r;
        for (r = 0; r < s; ++r) {
          if (x == n - 1) break;
          x = LongModular.mul(x, x, n);
        }
        if (r == s) return false;
      }
      return true;
    }

    public static long divisor(long n) {
      if (n == 1) return 1;
      if (isPrime(n)) return n;
      long d = n;
      while (d == n) {
        long a = 1 + RANDOM.nextLong() % (n - 1);
        long b = 1 + RANDOM.nextLong() % (n - 1);
        long x = 2, y = 2;
        d = -1;
        while (d == 1 || d == -1) {
          x = pollardRhoFunc(x, n, a, b);
          y = pollardRhoFunc(pollardRhoFunc(y, n, a, b), n, a, b);
          d = gcd(x - y, n);
        }
      }
      return d < 0 ? -d : d;
    }

    public static void divisors(long n, LongArrayList divisors) {
      factorizeInternal(n);
      divisors(P, R, divisors);
    }

    public static void divisors(LongArrayList p, IntArrayList r, LongArrayList divisors) {
      divisors.clear();
      divisors.add(1);
      for (int i = 0; i < p.size; ++i) {
        long prime = p.get(i);
        int size = divisors.size;
        for (int remExp = r.get(i); remExp > 0; --remExp) {
          for (int j = divisors.size - size, k = 0; k < size; ++j, ++k) {
            divisors.add(divisors.get(j) * prime);
          }
        }
      }
    }

    public static long gcd(long a, long b) {
      return b != 0 ? gcd(b, a % b) : a;
    }

    private static void factorizeInternal(long n) {
      P.clear();
      factorizeDfs(n);
      P.sortAndUnique(R);
    }

    private static void factorizeDfs(long n) {
      long divisor = divisor(n);
      if (divisor == n) {
        if (divisor > 1) P.add(divisor);
        return;
      }
      factorizeDfs(divisor);
      factorizeDfs(n / divisor);
    }

    private static long pollardRhoFunc(long x, long n, long a, long b) {
      return LongModular.mul(x, x + b, n) + a;
    }

  }

  static interface LongCollection {
  }
}