#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f;
const long long llinf = 0x3f3f3f3f3f3f3f3f;
template <typename INint>
inline void IN(INint &x) {
  x = 0;
  int f = 1;
  char c;
  cin.get(c);
  while (c < '0' || c > '9') {
    if (c == '-') f = -1;
    cin.get(c);
  }
  while (c >= '0' && c <= '9') {
    x = x * 10 + c - '0';
    cin.get(c);
  }
  x *= f;
}
template <typename INint>
inline void OUT(INint x) {
  if (x > 9) OUT(x / 10);
  cout.put(x % 10 + '0');
}
const int maxn = int(1e6 + 4);
const int maxnum = 25;
long long p[maxn];
long long po[maxn];
long long C[maxn][maxnum];
long long fac[maxn + maxnum], inv_fac[maxn + maxnum];
long long mod = 1e9 + 7;
void add(long long &a, const long long &b) {
  a += b;
  if (a > mod) a -= mod;
}
void mul(long long &a, const long long b) {
  a *= b;
  if (a > mod) a %= mod;
}
long long qpow(long long a, long long b, long long p) {
  long long ret = 1;
  while (b) {
    if (b & 1) ret = (ret * a) % p;
    a = (a * a) % p;
    b >>= 1;
  }
  return ret;
}
long long inv(long long a, long long p) { return qpow(a, p - 2, p); }
void init(long long n) {
  p[1] = 0;
  for (long long i = 2; i * i <= n; ++i) {
    if (!p[i]) {
      for (long long j = i; j <= n; j += i) {
        p[j] = i;
      }
    }
  }
  po[0] = 1;
  for (int i = 1; i <= int(n); i++) {
    po[i] = (po[i - 1] << 1) % mod;
  }
  fac[0] = 1;
  for (long long i = 1; i < maxn + maxnum; i++) {
    fac[i] = fac[i - 1] * i % mod;
  }
  inv_fac[maxn + maxnum - 1] = qpow(fac[maxn + maxnum - 1], mod - 2, mod);
  for (long long i = maxn + maxnum - 2; i >= 0; i--) {
    inv_fac[i] = inv_fac[i + 1] * (i + 1) % mod;
  }
}
long long solve(long long x, long long y) {
  vector<long long> v;
  while (x != 1) {
    long long mm = p[x];
    if (mm) {
      int tm(0);
      while (x % mm == 0) {
        ++tm;
        x /= mm;
      }
      v.push_back(tm);
    } else {
      v.push_back(1);
      x = 1;
    }
  }
  long long ans(1);
  for (auto p : v) {
    long long inc = 1;
    mul(inc, fac[y + p - 1]);
    mul(inc, inv_fac[p]);
    mul(inc, inv_fac[y - 1]);
    mul(ans, inc);
  }
  mul(ans, po[y - 1]);
  cout << ans << endl;
  return 1;
}
int main() {
  int T(1), times(0);
  std::ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> T;
  init(1000000 + 2);
  while (++times, T--) {
    long long x, y;
    cin >> x >> y;
    solve(x, y);
  }
  return 0;
}
