#include <bits/stdc++.h>
using namespace std;
void open() { freopen("data.txt", "r", stdin); }
void out() { freopen("out.txt", "w", stdout); }
const int maxn = 2e6 + 5;
const int MOD = 1e9 + 7;
std::vector<int> prime;
void getfac(int m) {
  prime.clear();
  int tmp = m;
  int t = floor(sqrt(tmp + 0.5));
  for (int i = 2; i < (t + 1); ++i) {
    if (tmp % i == 0) {
      prime.push_back(i);
      while (tmp % i == 0) tmp /= i;
    }
  }
  if (tmp > 1) prime.push_back(tmp);
}
long long fac[maxn];
long long inv[maxn];
long long QPow(long long x, long long n) {
  long long ret = 1;
  long long tmp = x % MOD;
  while (n) {
    if (n & 1) ret = (ret * tmp) % MOD;
    tmp = tmp * tmp % MOD;
    n >>= 1;
  }
  return ret;
}
void init() {
  fac[0] = 1;
  for (int i = 1; i < maxn; i++) fac[i] = fac[i - 1] * i % MOD;
  inv[maxn - 1] = QPow(fac[maxn - 1], MOD - 2);
  for (int i = maxn - 2; i >= 0; i--) inv[i] = inv[i + 1] * (i + 1) % MOD;
}
long long C(int a, int b) {
  if (b > a) return 0;
  if (b == 0) return 1;
  return fac[a] * inv[b] % MOD * inv[a - b] % MOD;
}
int main() {
  init();
  int T;
  scanf("%d", &T);
  while (T--) {
    int x, y;
    long long ans = 1;
    scanf("%d%d", &x, &y);
    getfac(x);
    for (int i = 0; i < (prime.size()); ++i) {
      long long pri = prime[i];
      long long tmp = x;
      long long k = 0;
      while (tmp % pri == 0) {
        k++;
        tmp /= pri;
      }
      ans = ans * C(y + k - 1, y - 1) % MOD;
    }
    ans = ans * QPow(2, y - 1) % MOD;
    cout << ans << endl;
  }
}
