#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 10;
int pre[26][2 * 100000 + 5];
int cnt[26];
char temp;
int main() {
  int k;
  scanf("%d", &k);
  while (k--) {
    int n, m;
    cin >> n >> m;
    for (int i = 1; i <= n; i++)
      for (int j = 0; j < 26; j++) pre[j][i] = 0;
    memset(cnt, 0, sizeof(cnt));
    for (int i = 1; i <= n; i++) {
      cin >> temp;
      for (int j = 0; j < 26; j++) pre[j][i] += pre[j][i - 1];
      pre[temp - 'a'][i]++;
    }
    for (int i = 1, z; i <= m; i++) {
      cin >> z;
      for (int j = 0; j < 26; j++) {
        cnt[j] += pre[j][z];
      }
    }
    for (int i = 0; i < 26; i++) cnt[i] += pre[i][n];
    for (int i = 0; i < 26; i++) {
      if (i == 25)
        printf("%d\n", cnt[i]);
      else
        cout << cnt[i] << " ";
    }
  }
}
