#include <bits/stdc++.h>
using namespace std;
struct node {
  int num[30];
} a[200005];
int b[200005];
int ans[30];
int main(void) {
  int t;
  cin >> t;
  while (t--) {
    memset(ans, 0, sizeof ans);
    for (int i = 1; i <= 200000; i++) {
      for (int j = 0; i < 26; i++) a[i].num[j] = 0;
    }
    int n, m;
    string s;
    cin >> n >> m >> s;
    for (int i = 1; i <= m; i++) cin >> b[i];
    s = " " + s;
    for (int i = 1; i <= n; i++) {
      for (int j = 0; j < 26; j++) {
        if (s[i] - 'a' == j)
          a[i].num[j] = a[i - 1].num[j] + 1;
        else
          a[i].num[j] = a[i - 1].num[j];
      }
      ans[s[i] - 'a']++;
    }
    for (int i = 1; i <= m; i++) {
      for (int j = 0; j < 26; j++) {
        ans[j] += a[b[i]].num[j];
      }
    }
    for (int i = 0; i < 26; i++) cout << ans[i] << " ";
    cout << endl;
  }
  return 0;
}
