#include <bits/stdc++.h>
using namespace std;
const long long N = 2e6 + 5;
const long long M = 1e9 + 7;
long long mod(long long m, long long mod = M) {
  m %= mod;
  return (m + mod) % mod;
}
long long power(long long x, long long y) {
  long long res = 1;
  x = mod(x);
  while (y > 0) {
    if (y & 1) res = mod(res * x);
    y = y / 2;
    x = mod(x * x);
  }
  return mod(res);
}
long long f[N], invf[N];
void fact() {
  f[0] = f[1] = 1;
  for (long long i = 2; i < N; i++) f[i] = mod(f[i - 1] * i);
  invf[N - 1] = power(f[N - 1], M - 2);
  for (long long i = N - 1; i > 0; i--) invf[i - 1] = mod(invf[i] * i);
}
long long nCr(long long n, long long r) {
  if (r > n) return 0;
  long long ans = f[n];
  ans = mod(ans * invf[n - r]);
  ans = mod(ans * invf[r]);
  return ans;
}
long long nPr(long long n, long long r) {
  if (r > n) return 0;
  long long ans = f[n];
  ans = mod(ans * invf[n - r]);
  return ans;
}
map<long long, long long> pfact(long long x) {
  long long n = x;
  map<long long, long long> mp;
  for (long long i = 2; i * i <= n; i++) {
    while (x % i == 0) {
      x /= i;
      mp[i]++;
    }
  }
  if (x > 1) mp[x]++;
  return mp;
}
int32_t main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  fact();
  long long t;
  cin >> t;
  while (t--) {
    long long x, y;
    cin >> x >> y;
    auto mp = pfact(x);
    long long ans = 1;
    for (auto p : mp) {
      long long tt = nCr(y + p.second - 1, p.second);
      ans = mod(ans * tt);
    }
    ans = mod(ans * power(2, y - 1));
    cout << ans << endl;
  }
}
