#include <bits/stdc++.h>
using namespace std;
const int Maxn = 1e6;
const long long Mod = 1e9 + 7;
long long f[Maxn + 55], inv[Maxn + 55];
long long pow2[Maxn + 5];
int lowp[Maxn + 5];
long long QuickPow(long long a, long long k) {
  long long ret = 1;
  while (k) {
    if (k & 1) ret = (ret * a) % Mod;
    a = (a * a) % Mod;
    k >>= 1;
  }
  return ret;
}
void Init() {
  memset(lowp, -1, sizeof lowp);
  f[0] = inv[0] = 1;
  for (int i = 1; i <= Maxn + 50; i++) f[i] = f[i - 1] * i % Mod;
  inv[Maxn + 50] = QuickPow(f[Maxn + 50], Mod - 2);
  for (int i = Maxn + 50 - 1; i >= 1; i--) inv[i] = inv[i + 1] * (i + 1) % Mod;
  for (int i = 2; i <= Maxn; i++)
    if (lowp[i] == -1) {
      for (int j = i; j <= Maxn; j += i) lowp[j] = i;
    }
  pow2[0] = 1;
  for (int i = 1; i <= Maxn; i++) pow2[i] = (pow2[i - 1] * 2LL) % Mod;
}
long long C(int n, int m) {
  if (n < m) return 0;
  return (f[n] * inv[m] % Mod * inv[n - m]) % Mod;
}
int main() {
  Init();
  int T;
  scanf("%d", &T);
  while (T--) {
    int x, y;
    scanf("%d %d", &x, &y);
    long long ans = pow2[y - 1];
    while (x != 1) {
      int cnt = 0;
      int tmp = lowp[x];
      while (lowp[x] == tmp) x /= lowp[x], cnt++;
      ans = (ans * C(y + cnt - 1, cnt)) % Mod;
    }
    printf("%lld\n", ans);
  }
  return 0;
}
