#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
const int maxn = 1010005;
int n, x, y, tot;
long long inv[maxn], jc[maxn], tw[maxn], p[1500], vis[1050];
long long kuai(long long x, int y) {
  long long ans = 1;
  while (y) {
    if (y & 1) (ans *= x) %= mod;
    (x *= x) %= mod;
    y >>= 1;
  }
  return ans % mod;
}
void pre() {
  for (int i = 2; i <= 1005; i++)
    if (!vis[i]) {
      p[++tot] = i;
      for (int j = i * i; j <= 1005; j += i) vis[j] = 1;
    }
  jc[0] = jc[1] = 1;
  tw[0] = 1;
  for (int i = 1; i <= maxn - 5; i++) tw[i] = tw[i - 1] * 2 % mod;
  for (int i = 1; i <= maxn - 5; i++) jc[i] = jc[i - 1] % mod * i % mod;
  inv[maxn - 5] = kuai(jc[maxn - 5], mod - 2);
  for (int i = maxn - 5; i >= 1; i--) inv[i - 1] = inv[i] * i % mod;
}
long long C(long long n, long long m) {
  if (n < m || n < 0 || m < 0) return 0;
  return jc[n] * inv[m] % mod * inv[n - m] % mod;
}
int main() {
  pre();
  cin >> n;
  while (n--) {
    cin >> x >> y;
    long long ans = 1;
    for (int i = 1; p[i] * p[i] <= x && i <= tot; i++) {
      int cnt = 0;
      while (x % p[i] == 0) x /= p[i], cnt++;
      if (cnt) ans = ans % mod * (C(y + cnt - 1, cnt) % mod) % mod;
    }
    if (x != 1) ans = ans * y % mod;
    ans = ans % mod * tw[y - 1] % mod;
    cout << ans % mod << endl;
  }
  return 0;
}
