#include <bits/stdc++.h>
using namespace std;
long long dp[200005][26];
int main() {
  int t;
  cin >> t;
  while (t-- > 0) {
    int n, m;
    cin >> n >> m;
    string s;
    cin >> s;
    for (int i = 0; i < n + 1; i++) {
      for (int j = 0; j < 26; j++) {
        dp[i][j] = 0;
      }
    }
    for (int i = 0; i < n; i++) {
      int x = s.at(i) - 'a';
      for (int j = 0; j < 26; j++) {
        if (j == x) {
          dp[i + 1][j] = dp[i][j] + 1;
        } else {
          dp[i + 1][j] = dp[i][j];
        }
      }
    }
    long long answer[26];
    for (int j = 0; j < 26; j++) {
      answer[j] = 0;
    }
    for (int i = 0; i < m; i++) {
      int temp;
      cin >> temp;
      for (int i = 0; i < 26; i++) {
        answer[i] += dp[temp][i];
      }
    }
    for (int i = 0; i < 26; i++) {
      answer[i] += dp[n][i];
    }
    for (int j = 0; j < 26; j++) {
      cout << answer[j] << " ";
    }
    cout << "\n";
  }
}
