#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f;
const int N = 2e5 + 100;
int vis[N];
long long cnt[30], temp[30];
char s[N];
int main() {
  int w;
  cin >> w;
  while (w--) {
    memset(vis, false, sizeof(vis));
    memset(cnt, 0, sizeof(cnt));
    memset(temp, 0, sizeof(temp));
    int n, m;
    scanf("%d%d%s", &n, &m, s + 1);
    for (int i = 1; i <= m; i++) {
      int pos;
      scanf("%d", &pos);
      vis[pos]++;
    }
    vis[n]++;
    for (int i = 1; i <= n; i++) {
      temp[s[i] - 'a']++;
      if (!vis[i]) continue;
      for (int j = 0; j < 26; j++) cnt[j] += temp[j] * vis[i];
    }
    for (int i = 0; i < 26; i++) printf("%lld ", cnt[i]);
    printf("\n");
  }
  return 0;
}
