#include <bits/stdc++.h>
using namespace std;
const int N = 2e6 + 7;
const long long mod = 1e9 + 7;
int q;
long long a[30], x, y, fac[N], two[N];
long long qmod(long long n, long long k) {
  long long ans = 1;
  while (k) {
    if (k & 1) ans = ans * n % mod;
    k >>= 1;
    n = n * n % mod;
  }
  return ans % mod;
}
long long inv(long long n) { return qmod(n, mod - 2); }
long long C(long long m, long long n) {
  long long M = fac[m];
  long long NM = fac[n] * fac[m - n] % mod;
  NM = M * inv(NM) % mod;
  return NM;
}
void init() {
  fac[0] = 1;
  two[0] = 1;
  for (int i = 1; i < N; i++) {
    two[i] = two[i - 1] * 2LL % mod;
    fac[i] = fac[i - 1] * i % mod;
  }
}
int main() {
  init();
  scanf("%d", &q);
  while (q--) {
    memset(a, 0, sizeof(a));
    int tot = 0;
    long long ans = 1;
    scanf("%lld%lld", &x, &y);
    for (int i = 2; i * i <= x; i++) {
      if (x % i == 0) {
        tot++;
        while (x % i == 0) {
          a[tot]++;
          x /= i;
        }
      }
    }
    if (x != 1) a[++tot] = 1;
    for (int i = 1; i <= tot; i++) ans = ans * C(y + a[i] - 1, a[i]) % mod;
    ans = ans * two[y - 1] % mod;
    printf("%lld\n", ans);
  }
  return 0;
}
