#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    map<int, int> mp, mp2, mp3;
    int n, m;
    cin >> n >> m;
    string s;
    cin >> s;
    int p[m];
    for (int i = 0; i < m; ++i) {
      cin >> p[i];
    }
    sort(p, p + m);
    int ct = 0;
    for (int i = 0; i < m; ++i) {
      string str = s.substr(ct, p[i] - ct);
      for (int j = 0; j < 26; ++j) {
        mp[j] += count(str.begin(), str.end(), 'a' + j) * (m - i);
      }
      ct = p[i];
    }
    for (int i = 0; i < n; ++i) {
      int x = s[i] - 'a';
      mp[x]++;
    }
    for (int i = 0; i < 26; ++i) {
      cout << mp[i] << " ";
    }
    cout << "\n";
  }
}
