#include <bits/stdc++.h>
using namespace std;
int main() {
  int q;
  cin >> q;
  while (q--) {
    map<char, long long int> d;
    string p;
    int n, m;
    cin >> n >> m;
    cin >> p;
    vector<map<char, long long int>> x(n + 2);
    for (int i = 0; i < n; i++) {
      x[i][p[i]]++;
      for (char j = 'a'; j <= 'z'; j++) {
        x[i + 1][j] = x[i][j];
        if (i == n - 1) d[j] = x[i][j];
      }
    }
    for (int i = 0; i < m; i++) {
      int y;
      cin >> y;
      y--;
      for (char j = 'a'; j <= 'z'; j++) {
        d[j] += x[y][j];
      }
    }
    for (char j = 'a'; j <= 'z'; j++) {
      cout << d[j] << " ";
    }
    cout << endl;
  }
  return 0;
}
