#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
const int Y = 1e6 + 5;
const int MAX = Y + 20;
const int MOD = 1e9 + 7;
const int64_t INF = INT_MAX;
const int64_t _INF = INT_MIN;
int sieve[Y], pfac[10];
int64_t fac[MAX], infac[MAX];
int64_t pw[Y];
int64_t mul(int64_t a, int64_t b) { return (a * b) % MOD; }
int64_t inv(int64_t val) {
  int64_t curr = 1, temp = MOD - 2;
  while (temp > 0) {
    if (temp & 1) curr = mul(curr, val);
    val = mul(val, val);
    temp >>= 1;
  }
  return curr;
}
void precompute() {
  for (int64_t p = 2; p < Y; p++) {
    if (!sieve[p]) {
      sieve[p] = p;
      for (int64_t i = p * p; i < Y; i += p) {
        if (!sieve[i]) sieve[i] = p;
      }
    }
  }
  fac[0] = 1;
  for (int i = 1; i <= MAX - 1; i++) fac[i] = mul(i, fac[i - 1]);
  infac[MAX - 1] = inv(fac[MAX - 1]);
  for (int i = MAX - 2; i >= 0; i--) infac[i] = mul(i + 1, infac[i + 1]);
  pw[0] = 1;
  for (int i = 1; i <= Y - 1; i++) pw[i] = mul(2, pw[i - 1]);
}
int64_t nCr(int a, int b) { return mul(mul(fac[a], infac[a - b]), infac[b]); }
int64_t solve(int x, int y) {
  int64_t curr = pw[y - 1];
  int cnt = 0, temp = 0;
  while (x > 1) {
    if (sieve[x] != temp) {
      temp = sieve[x];
      pfac[++cnt] = 0;
    }
    pfac[cnt]++;
    x /= temp;
  }
  for (int i = 1; i <= cnt; i++)
    curr = mul(curr, nCr(y - 1 + pfac[i], pfac[i]));
  return curr;
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  precompute();
  int q;
  cin >> q;
  while (q--) {
    int x, y;
    cin >> x >> y;
    cout << solve(x, y) << "\n";
  }
}
