#include <bits/stdc++.h>
using namespace std;
const int modd = 1e9 + 7;
inline int add(int a, int b) { return a + b >= modd ? a + b - modd : a + b; }
inline void inc(int& a, int b) { a = add(a, b); }
inline int sub(int a, int b) { return a - b < 0 ? a - b + modd : a - b; }
inline void dec(int& a, int b) { a = sub(a, b); }
const int inf = 1e8;
const int mxN = 2000005;
const int di[] = {0, -1, 0, 1};
const int dj[] = {1, 0, -1, 0};
int f[mxN], inv[mxN], spf[mxN];
int expo(int base, int exponent, int mod) {
  int ans = 1;
  while (exponent != 0) {
    if (exponent & 1) ans = (1LL * ans * base) % mod;
    base = (1LL * base * base) % mod;
    exponent >>= 1;
  }
  return ans % mod;
}
void compute() {
  f[0] = 1;
  for (int i = 1; i < mxN; i++) {
    f[i] = (1LL * i * f[i - 1]) % modd;
  }
  inv[mxN - 1] = expo(f[mxN - 1], modd - 2, modd);
  for (int i = mxN - 2; i >= 0; i--) {
    inv[i] = (1LL * (i + 1) * inv[i + 1]) % modd;
  }
}
void compute_spf() {
  for (int i = 1; i < mxN; i++) spf[i] = i;
  for (int i = 2; i < mxN; i++) {
    if (spf[i] == i) {
      for (int j = 2 * i; j < mxN; j += i) {
        if (spf[j] == j) spf[j] = i;
      }
    }
  }
}
int C(int n, int r) {
  if (n < r) return 0;
  return (1LL * ((1LL * f[n] * inv[r]) % modd) * inv[n - r]) % modd;
}
int main() {
  compute();
  compute_spf();
  int tt;
  cin >> tt;
  while (tt--) {
    int x, y;
    cin >> x >> y;
    int ans = 1;
    while (x > 1) {
      int pf = spf[x];
      int ct = 0;
      while (x % pf == 0) {
        ct++;
        x /= pf;
      }
      ans = (ans * 1LL * C(y + ct - 1, ct)) % modd;
    }
    ans = (ans * 1LL * expo(2, y - 1, modd)) % modd;
    cout << ans << endl;
  }
}
