#include <bits/stdc++.h>
using namespace std;
long long MOD = 1000 * 1000 * 1000 + 7;
vector<long long> factorial;
void fillfactorialMOD(int n) {
  factorial.resize(n + 1);
  factorial[0] = 1;
  factorial[1] = 1;
  for (int i = 2; i < n + 1; i++) factorial[i] = (i * factorial[i - 1]) % MOD;
}
long long powe(long long x, long long p) {
  if (p == 0) return 1;
  long long w = powe(x, p / 2);
  if (p & 1) return ((w * w) % MOD * x) % MOD;
  return (w * w) % MOD;
}
long long modinv(long long i) { return powe(i, MOD - 2); }
long long nCr(long long n, long long r) {
  return (((factorial[n] * modinv(factorial[r])) % MOD) *
          modinv(factorial[n - r])) %
         MOD;
}
int spf[2000001];
void sieve() {
  spf[1] = 1;
  for (int i = 2; i < 2000001; i++) spf[i] = i;
  for (int i = 4; i < 2000001; i += 2) spf[i] = 2;
  for (int i = 3; i * i < 2000001; i++) {
    if (spf[i] == i) {
      for (int j = i * i; j < 2000001; j += i)
        if (spf[j] == j) spf[j] = i;
    }
  }
}
vector<int> getFactorization(int x) {
  vector<int> ret;
  while (x != 1) {
    ret.push_back(spf[x]);
    x = x / spf[x];
  }
  return ret;
}
int main() {
  int q;
  cin >> q;
  sieve();
  fillfactorialMOD(2e6);
  while (q--) {
    int x, y;
    cin >> x >> y;
    long long ans = powe(2, y - 1);
    vector<int> pr = getFactorization(x);
    for (int i = 0; i < pr.size(); i++) {
      int j = i, cnt = 0;
      while (j < pr.size() && pr[j] == pr[i]) {
        j++;
        cnt++;
      }
      ans = (ans * nCr(y + cnt - 1, cnt)) % MOD;
      i = j - 1;
    }
    cout << ans << endl;
  }
}
