#include <bits/stdc++.h>
using namespace std;
clock_t start;
mt19937_64 rng(chrono::system_clock::now().time_since_epoch().count());
template <typename T>
void _F(const char *name, T arg1) {
  cerr << name << " = " << arg1 << '\n';
}
template <typename T, typename... Args>
void _F(const char *names, T arg1, Args... args) {
  const char *name = strchr(names, ',');
  cerr.write(names, name - names) << " = " << arg1 << '\n';
  _F(name + 2, args...);
}
template <typename T1, typename T2>
istream &operator>>(istream &in, pair<T1, T2> &q) {
  in >> q.first >> q.second;
  return in;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &out, pair<T1, T2> &q) {
  out << q.first << " " << q.second;
  return out;
}
template <typename T1, typename T2>
pair<T1, T2> operator+(pair<T1, T2> p1, pair<T1, T2> p2) {
  return {p1.first + p2.first, p1.second + p2.second};
}
template <typename T1, typename T2>
pair<T1, T2> operator-(pair<T1, T2> p1, pair<T1, T2> p2) {
  return {p1.first - p2.first, p1.second - p2.second};
}
template <typename T1, typename T2>
bool operator<(pair<T1, T2> p1, pair<T1, T2> p2) {
  return p1 < p2;
}
template <typename T>
void Unique(vector<T> &v) {
  sort((v).begin(), (v).end()),
      v.resize(distance(v.begin(), unique((v).begin(), (v).end())));
}
const long long N = 1e6 + 1;
const long long M = 1e9 + 7;
const long long MOD = 1e9 + 7;
long long dp[21][21];
long long p[N];
long long fun(long long i, long long j) {
  if (j < 0) return 0;
  if (j > i) return (dp[i][j] = 0);
  if (j == i) return (dp[i][j] = 1);
  if (dp[i][j] != -1) return dp[i][j];
  dp[i][j] = 0;
  for (long long pick = 1; pick <= i; pick++) {
    dp[i][j] += fun(i - pick, j - 1);
    dp[i][j] %= M;
  }
  return dp[i][j];
}
struct Comb {
  long long fac[N], inv[N];
  void seive() {
    for (long long i = 2; i < N; i++) {
      if (p[i]) continue;
      for (long long j = i; j < N; j += i) {
        if (!p[j]) p[j] = i;
      }
    }
  }
  long long modPow(long long b, long long p) {
    long long r = 1;
    while (p) {
      if (p & 1) r = r * b % MOD;
      b = (b * b) % MOD;
      p >>= 1;
    }
    return r;
  }
  Comb() {
    fac[0] = inv[0] = 1;
    for (long long i = 1; i < N; i++) {
      fac[i] = fac[i - 1] * i % MOD;
    }
    inv[N - 1] = modPow(fac[N - 1], MOD - 2);
    for (long long i = N - 2; i >= 0; i--) {
      inv[i] = inv[i + 1] * (i + 1) % MOD;
    }
  }
  long long ncr(long long n, long long r) {
    if (r > n) return 0;
    return fac[n] * inv[r] % MOD * inv[n - r] % MOD;
  }
} cc;
void solve(long long &test) {
  long long x, y;
  cin >> x >> y;
  if (x == 1) {
    cout << cc.modPow(2, y - 1) << '\n';
    return;
  }
  std::vector<long long> v;
  while (x != 1) {
    long long d = p[x];
    while (x % d == 0) x /= d, v.push_back(d);
  }
  long long ans = 1;
  for (long long i = 0; i < (long long)((v).size());) {
    long long j = i;
    while (i < (long long)((v).size()) && v[i] == v[j]) i++;
    long long len = i - j, tmp = 0;
    for (long long k = 1; k <= len; k++) {
      tmp += ans * dp[len][k] % M * cc.ncr(y, k) % M;
      tmp %= M;
    }
    ans = tmp;
  }
  cout << ans * cc.modPow(2, y - 1) % M << '\n';
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long t = 1;
  start = clock();
  cout << fixed << setprecision(20);
  memset(dp, -1, sizeof(dp));
  for (long long i = 1; i <= 20; i++) {
    for (long long j = 1; j <= 20; j++) {
      fun(i, j);
    }
  }
  cc.seive();
  cin >> t;
  for (long long i = 1; i <= t; ++i) {
    solve(i);
  }
  cerr << (double(clock() - start) / double(CLOCKS_PER_SEC));
  return 0;
}
