#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  int tt = 1;
  cin >> tt;
  while (tt--) {
    int n, m;
    cin >> n >> m;
    int a[200000];
    string s;
    cin >> s;
    for (int i = 0; i < m; i++) cin >> a[i];
    int ans[26] = {0};
    vector<int> v(26, 0);
    for (auto x : s) ans[x - 'a']++;
    map<int, vector<int>> mm;
    for (int i = 0; i < n; i++) {
      v[s[i] - 'a']++;
      mm[i + 1] = v;
    }
    for (int i = 0; i < m; i++) {
      for (int j = 0; j < 26; j++) ans[j] += mm[a[i]][j];
    }
    for (auto x : ans) cout << x << " ";
    cout << endl;
  }
}
