#include <bits/stdc++.h>
using namespace std;
long long tot[28], arr[300007][28], prr[300007];
int main() {
  long long test, n, m;
  string s;
  cin >> test;
  while (test--) {
    cin >> n >> m;
    cin >> s;
    for (int i = 0; i <= n + 10; ++i) {
      for (int j = 0; j < 27; ++j) {
        arr[i][j] = 0;
      }
    }
    for (int i = 0; i < 27; ++i) tot[i] = 0;
    for (int i = 0; i < m; ++i) cin >> prr[i];
    for (int i = 0; i < n; ++i) {
      tot[s[i] - 'a']++;
      for (int j = 0; j < 26; ++j) {
        arr[i][j] = tot[j];
      }
    }
    prr[m] = n;
    for (int i = 0; i < 27; ++i) tot[i] = 0;
    for (int i = 0; i <= m; ++i) {
      for (int j = 0; j < 26; ++j) {
        tot[j] += arr[prr[i] - 1][j];
      }
    }
    for (int j = 0; j < 26; ++j) cout << tot[j] << " ";
  }
  return 0;
}
