#include <bits/stdc++.h>
using namespace std;
long long arr[1000505];
long long prima[1000505];
long long faktorial[1000505];
void sieve(long long a) {
  for (long long i = 2; i * i <= a; i++) {
    if (arr[i] == 0) {
      for (long long j = i * i; j <= a; j += i) {
        arr[j] = 1;
      }
    }
  }
  long long idx = 0;
  for (long long i = 2; i <= a; i++) {
    if (arr[i] == 0) {
      prima[idx] = i;
      idx++;
    }
  }
}
long long pangkat(long long a, long long b) {
  if (b == 0) return 1;
  if (b % 2 == 0) {
    long long tampung = pangkat(a, b / 2);
    return (tampung * tampung) % 1000000007;
  } else {
    return (a * pangkat(a, b - 1)) % 1000000007;
  }
}
long long fungsi(long long a, long long b) {
  long long jawaban =
      (faktorial[a] * pangkat(faktorial[a - b], 1000000005) % 1000000007) *
      pangkat(faktorial[b], 1000000005) % 1000000007;
  return jawaban;
}
int main() {
  long long a, tc, i, j, b, jawaban, ada;
  faktorial[0] = 1;
  for (long long i = 1; i <= 1000500; i++) {
    faktorial[i] = i * faktorial[i - 1] % 1000000007;
  }
  sieve(1205);
  scanf("%lld", &tc);
  getchar();
  for (i = 0; i < tc; i++) {
    jawaban = 1;
    scanf("%lld %lld", &a, &b);
    getchar();
    ada = 0;
    for (j = 0; prima[j] * prima[j] <= a; j++) {
      if (a % prima[j] == 0) {
        ada = 0;
        while (a % prima[j] == 0) {
          ada++;
          a = a / prima[j];
        }
        jawaban = jawaban * fungsi(ada + b - 1, b - 1) % 1000000007;
      }
      if (a == 1) break;
    }
    if (a != 1) {
      jawaban = jawaban * fungsi(b, b - 1) % 1000000007;
    }
    printf("%lld\n", (pangkat(2, b - 1) * jawaban) % 1000000007);
  }
  return 0;
}
