#include <bits/stdc++.h>
using namespace std;
long long int fact[1000105];
long long int ifact[1000105];
long long int bexpo(long long int x, long long int n, long long int m) {
  long long int r = 1;
  x = x % m;
  while (n > 0) {
    if (n % 2) r = r * x % m;
    n = n / 2;
    x = x * x % m;
  }
  return r;
}
void pre() {
  fact[0] = 1;
  for (long long int i = 1; i < 1000105; i++)
    fact[i] = fact[i - 1] * i % 1000000007;
  ifact[0] = 1;
  ifact[1000105 - 1] = bexpo(fact[1000105 - 1], 1000000007 - 2, 1000000007);
  for (long long int i = 1000105 - 2; i > 0; i--)
    ifact[i] = (i + 1) * ifact[i + 1] % 1000000007;
}
long long int ncr(long long int n, long long int r) {
  if (r > n) return 0;
  long long int ans = fact[n] * ifact[r] % 1000000007;
  ans = ans * ifact[n - r] % 1000000007;
  return ans;
}
long long int minprime[1000105];
int main() {
  pre();
  minprime[1] = 1;
  for (long long int i = 2; i < 1000105; i++) {
    if (!minprime[i])
      for (long long int j = i * i; j < 1000105; j += i) minprime[j] = i;
  }
  for (long long int i = 1; i < 1000105; i++)
    if (minprime[i] == 0) minprime[i] = i;
  long long int t;
  scanf("%lld", &t);
  for (long long int oo = 1; oo <= t; oo++) {
    long long int x, y;
    scanf("%lld%lld", &x, &y);
    long long int ans = bexpo(2, y - 1, 1000000007);
    while (x > 1) {
      long long int oho = minprime[x];
      long long int cnt = 0;
      while ((x % oho) == 0) x = x / oho, cnt++;
      ans = ans * ncr(cnt + y - 1, y - 1) % 1000000007;
    }
    printf("%lld\n", ans);
  }
  return 0;
}
