#include <bits/stdc++.h>
using namespace std;
template <typename T>
void FastScan(T &number) {
  bool negative = false;
  int c;
  number = 0;
  c = getchar();
  if (c == '-') {
    negative = true;
    c = getchar();
  }
  for (; (c > 47 && c < 58); c = getchar()) number = number * 10 + c - 48;
  if (negative) number *= -1;
}
template <typename T>
void FastPrint(T number) {
  if (number < 0) {
    putchar('-');
    number *= -1;
  }
  if (number > 9) FastPrint(number / 10);
  putchar(48 + number % 10);
  return;
}
const int Sz = 2e6 + 5;
const long long Mod = 1e9 + 7;
long long Power(long long a, long long n) {
  if (n == 0) return 1;
  if (n == 1) return a;
  if (n & 1) return a % Mod * Power(a * a % Mod, n >> 1) % Mod;
  return Power(a * a % Mod, n >> 1) % Mod;
}
int lpd[Sz];
void Sieve() {
  for (int i = 2; i * i < Sz; i++) {
    if (lpd[i] != 0) continue;
    lpd[i] = i;
    for (int j = i * i; j < Sz; j += i)
      if (lpd[j] == 0) lpd[j] = i;
  }
}
vector<array<long long, 2> > f(int x) {
  vector<array<long long, 2> > res;
  while (x != 1) {
    if (lpd[x] == 0) lpd[x] = x;
    if (res.empty() || res.back()[0] != lpd[x]) res.push_back({lpd[x], 0});
    res.back()[1]++;
    x /= lpd[x];
  }
  return res;
}
long long mem[Sz];
int q, x, y;
long long xCy(int x, int y) {
  return mem[x] % Mod * Power(mem[y] % Mod * mem[x - y] % Mod, Mod - 2) % Mod;
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  Sieve();
  mem[0] = 1;
  for (int i = 1; i < Sz; i++) mem[i] = mem[i - 1] * i % Mod;
  cin >> q;
  while (q--) {
    cin >> x >> y;
    vector<array<long long, 2> > a = f(x);
    long long res = Power(2, y - 1) % Mod;
    for (array<long long, 2> i : a) {
      res *= xCy(y + i[1] - 1, i[1]);
      res %= Mod;
    }
    cout << res << endl;
  }
  return 0;
}
