#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
const int maxB = 31;
int P(int b, int p) {
  int ans = 1;
  for (int i = 0; i < maxB; ++i, b = (1LL * b * b) % mod)
    if (p & (1 << i)) ans = (1LL * ans * b) % mod;
  return ans;
}
int C(int n, int k) {
  int ans = 1;
  for (int i = 0; i < k; ++i) ans = (1LL * ans * (n - i)) % mod;
  for (int i = 1; i <= k; ++i) ans = (1LL * ans * P(i, mod - 2)) % mod;
  return ans;
}
int main() {
  int q, x, y;
  scanf("%d", &q);
  while (q--) {
    scanf("%d %d", &x, &y);
    int ans = P(2, y - 1);
    for (int i = 2; i * i <= x; ++i)
      if (x % i == 0) {
        int cnt = 0;
        while (x % i == 0) x /= i, ++cnt;
        ans = (1LL * ans * C(cnt + y - 1, cnt)) % mod;
      }
    if (x > 1) ans = (1LL * ans * y) % mod;
    printf("%d\n", ans);
  }
  return 0;
}
