#include <bits/stdc++.h>
using namespace std;
const long long inf = 0x3f3f3f3f3f3f3f3f;
const long long p = 107;
const long long P = 100007;
const long long Mod = 1e9 + 7;
const long double eps = 1e-14;
const long long Maxn = 2e6;
long long n, m;
long long A[2000005], AA[2000005];
long long cnt[2000005], tot;
long long Qp(long long a, long long n) {
  long long ans = 1, tmp = a;
  while (n) {
    if (n & 1) ans = ans * tmp % Mod;
    tmp = tmp * tmp % Mod;
    n >>= 1;
  }
  return ans;
}
void init() {
  A[0] = 1;
  for (long long i = 1; i <= Maxn; i++) A[i] = A[i - 1] * i % Mod;
  AA[Maxn] = Qp(A[Maxn], Mod - 2);
  for (long long i = Maxn; i >= 1; i--) AA[i - 1] = AA[i] * i % Mod;
}
long long C(long long n, long long m) {
  return A[n] * AA[n - m] % Mod * AA[m] % Mod;
}
void work() {
  cin >> n >> m;
  tot = 0;
  for (long long i = 2; i * i <= n; i++) {
    if (n % i != 0) continue;
    cnt[++tot] = 0;
    while (n % i == 0) {
      ++cnt[tot];
      n /= i;
    }
  }
  if (n != 1) cnt[++tot] = 1;
  long long ans = Qp(2ll, m - 1);
  for (long long i = 1; i <= tot; i++) {
    ans = ans * C(cnt[i] + m - 1, m - 1) % Mod;
  }
  cout << ans << endl;
}
signed main() {
  init();
  long long T = 1;
  cin >> T;
  while (T--) {
    work();
  }
  return 0;
}
