#include <bits/stdc++.h>
using namespace std;
const long long MAX_N = 2e5 + 11;
char s[MAX_N];
long long freq[26 + 1];
long long p[MAX_N], pref[MAX_N];
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  long long tc;
  cin >> tc;
  while (tc--) {
    long long n, m;
    cin >> n >> m;
    memset(freq, 0, sizeof freq);
    for (long long i = 1; i <= n; i++) {
      pref[i] = 0;
      cin >> s[i];
      freq[s[i] - 'a']++;
    }
    pref[n + 1] = 0;
    for (long long i = 1; i <= m; i++) {
      long long x;
      cin >> x;
      pref[1]++;
      pref[x + 1]--;
    }
    for (long long i = 1; i <= n; i++) {
      pref[i] += pref[i - 1];
      freq[s[i] - 'a'] += pref[i];
    }
    for (long long i = 0; i < 26; i++) cout << freq[i] << " ";
    cout << endl;
  }
}
