#include <bits/stdc++.h>
using namespace std;
int t, n, m, num[27], ans[27], vis[200005];
char str[200005];
void deal() {
  cin >> n >> m;
  char c = getchar();
  while (c != '\n') c = getchar();
  for (int i = 1; i <= n; i++) str[i] = getchar();
  memset(vis, 0, sizeof(vis));
  for (int i = 1; i <= m; i++) {
    int p;
    cin >> p;
    vis[p]++;
  }
  memset(num, 0, sizeof(num));
  memset(ans, 0, sizeof(ans));
  for (int i = 1; i <= n; i++) {
    num[int(str[i] - 'a') + 1]++;
    for (int j = 1; j <= 26; j++) {
      ans[j] += num[j] * vis[i];
    }
    ans[int(str[i] - 'a') + 1]++;
  }
  for (int i = 1; i <= 26; i++) printf("%d ", ans[i]);
  printf("\n");
  return;
}
int main() {
  cin >> t;
  for (int i = 1; i <= t; i++) deal();
  return 0;
}
