#include <bits/stdc++.h>
using namespace std;
const long long INF = 2000000000000000000LL;
const int inf = 0x3f3f3f3f;
const long double EPS = 1e-9;
const int maxn = 2e5 + 5;
long long frecnt[27][maxn], sum[27];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  int test;
  cin >> test;
  while (test--) {
    int n, m;
    string str;
    cin >> n >> m;
    cin >> str;
    std::vector<int> v(m);
    for (int i = 0; i < m; i++) {
      cin >> v[i];
    }
    str = "#" + str;
    for (int i = 0; i < 26; i++) {
      frecnt[i][0] = 0;
      sum[i] = 0;
      for (int j = 1; j < str.size(); j++) {
        frecnt[i][j] = frecnt[i][j - 1];
        if (str[j] == char(i + 'a')) {
          frecnt[i][j]++;
        }
      }
    }
    for (int j = 1; j < str.size(); j++) {
      sum[(str[j] - 'a')]++;
    }
    for (int i = 0; i < v.size(); i++) {
      for (int j = 0; j < 26; j++) {
        sum[j] += frecnt[j][v[i]];
      }
    }
    for (int i = 0; i < 26; i++) {
      cout << sum[i] << " ";
    }
    cout << endl;
  }
  return 0;
}
