#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 10;
int t, n, m, x, ans[26], s[26][maxn];
char ch;
int main() {
  cin >> t;
  while (t--) {
    cin >> n >> m;
    for (int i = 1; i <= n; i++) {
      cin >> ch;
      for (char j = 'a'; j <= 'z'; j++) {
        if (ch != j)
          s[j - 'a'][i] = s[j - 'a'][i - 1];
        else
          s[j - 'a'][i] = s[j - 'a'][i - 1] + 1;
      }
    }
    for (int i = 1; i <= m; i++) {
      cin >> x;
      for (int j = 0; j < 26; j++) ans[j] += s[j][x];
    }
    for (int i = 0; i < 26; i++) ans[i] += s[i][n];
    for (int i = 0; i < 26; i++) cout << ans[i] << " ";
    cout << endl;
    memset(ans, 0, sizeof(ans));
    for (int i = 1; i <= n; i++)
      for (int j = 0; j < 26; j++) s[j][i] = 0;
  }
  return 0;
}
