#include <bits/stdc++.h>
using namespace std;
const int mxn = 1e6 + 100, mod = 1e9 + 7;
int sp[mxn], finv[mxn], f[mxn], pw[mxn];
int mult(int a, int b) {
  long long c = 1LL * a * b;
  return c >= mod ? c % mod : c;
}
int add(int a, int b) {
  for (a += b; a >= mod; a -= mod)
    ;
  return a;
}
int sub(int a, int b) { return add(a, mod - b); }
int expo(int a, int b) {
  int c = 1;
  for (; b > 0; b >>= 1, a = mult(a, a))
    if (b & 1) c = mult(c, a);
  return c;
}
int C(int n, int r) {
  return n < 0 || r < 0 || r > n ? 0 : mult(f[n], mult(finv[n - r], finv[r]));
}
int main() {
  finv[0] = f[0] = f[1] = finv[1] = pw[0] = 1, pw[1] = 2;
  for (int i = 2; i < mxn; ++i) {
    if (!sp[i])
      for (int j = i; j < mxn; j += i)
        if (!sp[j]) sp[j] = i;
    f[i] = mult(i, f[i - 1]);
    finv[i] = expo(f[i], mod - 2);
    pw[i] = mult(pw[i - 1], 2);
  }
  int q, x, y, ret;
  for (scanf("%d", &q); q--;) {
    scanf("%d%d", &x, &y), ret = 1;
    for (int p, c; x > 1; ++p) {
      for (c = 0, p = sp[x]; sp[x] == p; x /= p, ++c)
        ;
      ret = mult(ret, C(c + y - 1, y - 1));
    }
    ret = mult(ret, pw[y - 1]);
    printf("%d\n", ret);
  }
}
