#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e6 + 100;
const long long mod = 1e9 + 7;
long long fact[maxn], rfact[maxn], ame[maxn];
bool p[maxn];
vector<long long> f[maxn];
long long pow(long long a, long long b) {
  if (!b) {
    return 1;
  }
  long long t = pow(a, b / 2);
  t = t * t % mod;
  if (b & 1) {
    t = t * a % mod;
  }
  return t;
}
long long en(long long k, long long n) {
  if (k < 0 || k > n) {
    return 0;
  }
  return fact[n] * rfact[k] % mod * rfact[n - k] % mod;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  fill(p, p + maxn, 1);
  p[0] = p[1] = 0;
  for (int i = 2; i < maxn; ++i) {
    if (p[i]) {
      for (int j = i * 2; j < maxn; j += i) {
        p[j] = 0;
      }
    }
  }
  for (int i = 0; i < maxn; ++i) {
    if (p[i]) {
      for (int j = i; j < maxn; j += i) {
        f[j].push_back(i);
      }
    }
  }
  fact[0] = 1;
  for (int i = 1; i < maxn; ++i) {
    fact[i] = fact[i - 1] * i % mod;
  }
  rfact[maxn - 1] = pow(fact[maxn - 1], mod - 2);
  for (int i = maxn - 2; i >= 0; --i) {
    rfact[i] = rfact[i + 1] * (i + 1) % mod;
  }
  int q;
  cin >> q;
  ame[0] = 1;
  for (int i = 1; i < maxn; ++i) {
    ame[i] = ame[i - 1] * 2 % mod;
  }
  while (q--) {
    long long res = 1;
    int x, y, xx;
    cin >> x >> y;
    for (int j = 0; j < f[x].size(); ++j) {
      xx = x;
      long long a = f[x][j];
      long long num = 0;
      while (xx % a == 0) {
        xx /= a;
        num++;
      }
      res = res * en(num, y + num - 1) % mod;
    }
    cout << (res * ame[y - 1] % mod) << endl;
  }
  return 0;
}
