#include <bits/stdc++.h>
using namespace std;
struct custom_hash {
  static uint64_t splitmix64(uint64_t x) {
    x += 0x9e3779b97f4a7c15;
    x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
    x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
    return x ^ (x >> 31);
  }
  size_t operator()(uint64_t x) const {
    static const uint64_t FIXED_RANDOM =
        chrono::steady_clock::now().time_since_epoch().count();
    return splitmix64(x + FIXED_RANDOM);
  }
};
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long tc;
  cin >> tc;
  while (tc--) {
    long long n, m;
    cin >> n >> m;
    string s;
    cin >> s;
    long long arr[m];
    for (long long i = 0; i < m; i++) cin >> arr[i];
    long long MM = 97;
    long long dp[n + 1][26];
    unordered_map<long long, long long, custom_hash> mp;
    for (auto ch : s) mp[ch % MM]++;
    for (long long i = 0; i < 26; i++) {
      dp[n][i] = mp[i];
    }
    for (long long i = n - 1; i >= 1; i--) {
      long long target = s[i] % MM;
      for (long long j = 0; j < 26; j++) {
        if (target == j) {
          dp[i][j] = dp[i + 1][j] - 1;
        } else {
          dp[i][j] = dp[i + 1][j];
        }
      }
    }
    long long res[26];
    for (long long i = 0; i < 26; i++) {
      res[i] = dp[n][i];
    }
    for (long long i = 0; i < m; i++) {
      long long l = arr[i];
      for (long long j = 0; j < 26; j++) res[j] += dp[l][j];
    }
    for (long long i = 0; i < 26; i++) cout << res[i] << " ";
  }
  return 0;
}
