#include <bits/stdc++.h>
using namespace std;
vector<int> addv(vector<int> a, vector<int> b) {
  for (int i = 0; i < 26; ++i) {
    a[i] += b[i];
  }
  return a;
}
int main(int argc, char const *argv[]) {
  int t;
  cin >> t;
  while (t--) {
    int n, m;
    cin >> n >> m;
    string s;
    cin >> s;
    vector<int> a[n + 1];
    a[0] = vector<int>(26, 0);
    for (int i = 0; i < n; ++i) {
      a[i + 1] = a[i];
      a[i + 1][s[i] - 'a']++;
    }
    vector<int> p(m, 0);
    for (int i = 0; i < m; ++i) {
      cin >> p[i];
    }
    vector<int> ans(26, 0);
    for (auto it : p) {
      ans = addv(ans, a[it]);
    }
    ans = addv(ans, a[n]);
    for (auto it : ans) {
      cout << it << " ";
    }
    cout << endl;
  }
  return 0;
}
