#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
const long long max3 = 1003;
const long long max4 = 10004;
const long long maxx = 100005;
const long long max6 = 1000006;
const long long max7 = 10000007;
const long long lg4 = 13;
const long long lg5 = 17;
const long long lg6 = 20;
const long long INF = 2LL * 1000000000;
const long long INFLL = 9LL * 1000000000 * 1000000000;
long long powmod(long long a, long long b, long long mod) {
  long long res = 1;
  a %= mod;
  for (; b; b >>= 1) {
    if (b & 1) res = (res * a) % mod;
    a = (a * a) % mod;
  }
  return res;
}
long long gcd(long long a, long long b) {
  while (b > 0) {
    long long t = a % b;
    a = b, b = t;
  }
  return a;
}
long long lcm(long long a, long long b) { return (a / gcd(a, b)) * b; }
long long is_prime(long long n) {
  if (n <= 1 || n > 3 && (n % 2 == 0 || n % 3 == 0)) return 0;
  for (long long i = 5, t = 2; i * i <= n; i += t, t = 6 - t)
    if (n % i == 0) return 0;
  return 1;
}
const long long MOD = 1e9 + 7;
long long inv(long long x) { return powmod(x, MOD - 2, MOD); }
long long fac[max6 + 500];
long long C(long long n, long long k) {
  return (((fac[n] * inv(fac[k])) % MOD) * inv(fac[n - k])) % MOD;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie();
  ;
  fac[0] = 1;
  for (long long i = 1; i < max6 + 500; i++) {
    fac[i] = (fac[i - 1] * i) % MOD;
  }
  long long q;
  cin >> q;
  while (q--) {
    long long x, y;
    cin >> x >> y;
    vector<long long> v;
    long long cnt;
    for (long long i = 2; i * i <= x; i++) {
      if (x % i == 0) {
        cnt = 0;
        while (x % i == 0) {
          cnt++;
          x /= i;
        }
        v.push_back(cnt);
      }
    }
    if (x > 1) {
      v.push_back(1);
    }
    long long e, res = 1;
    for (long long i = 0; i < v.size(); i++) {
      e = v[i];
      res = (res * C(y - 1 + e, y - 1)) % MOD;
    }
    res = (res * powmod(2, y - 1, MOD)) % MOD;
    cout << res << '\n';
  }
  return 0;
}
