#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline T read() {
  char c = getchar();
  T x = 0, f = 1;
  while (!isdigit(c)) {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (isdigit(c)) x = (x << 3) + (x << 1) + (c ^ 48), c = getchar();
  return x * f;
}
template <typename T>
inline void write(T x) {
  if (x < 0) x = (~x) + 1, putchar('-');
  if (x / 10) write(x / 10);
  putchar(x % 10 | 48);
}
const int INF = 0x3f3f3f3f;
long long int qz[200005][30];
long long int ans[30];
int main() {
  int T = read<int>();
  while (T--) {
    memset(ans, 0, sizeof(ans));
    int n = read<int>(), m = read<int>();
    for (int i = 1; i <= n; i++) {
      char c;
      cin >> c;
      int a = c - 'a';
      ans[a]++;
      for (int j = 0; j < 26; j++) qz[i][j] = qz[i - 1][j];
      qz[i][a] = qz[i - 1][a] + 1;
    }
    for (int i = 0; i < m; i++) {
      int a = read<int>();
      for (int j = 0; j < 26; j++) {
        ans[j] += qz[a][j];
      }
    }
    for (int i = 0; i < 26; i++) {
      cout << ans[i] << " ";
    }
    cout << endl;
  }
}
