#include <bits/stdc++.h>
using namespace std;
long long p[200010];
char ch[200010];
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n, m;
    scanf("%d%d", &n, &m);
    getchar();
    gets(ch);
    for (int i = 1; i <= m; ++i) scanf("%d", &p[i]);
    static long long cnt[26][200010] = {0};
    for (int i = 1; i <= n; ++i) {
      for (int j = 0; j < 26; ++j) cnt[j][i] = cnt[j][i - 1];
      cnt[ch[i - 1] - 'a'][i]++;
    }
    long long sav[26] = {0};
    for (int i = 1; i <= m; ++i) {
      for (int j = 0; j < 26; ++j) sav[j] += cnt[j][p[i]];
    }
    for (int j = 0; j < 26; ++j) sav[j] += cnt[j][n];
    printf("%lld", sav[0]);
    for (int i = 1; i < 26; ++i) printf(" %lld", sav[i]);
    printf("\n");
  }
  return 0;
}
