#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
const long long INF = 0x3f3f3f3f;
const long long mod = 1000000009;
const long long maxn = 200005;
void std_quick_io() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}
long long cot[26][maxn];
int n, m;
int lowbit(int x) { return x & (-x); }
long long sum1(int x, int k) {
  long long s = 0;
  while (x) {
    s += cot[k][x];
    x -= lowbit(x);
  }
  return s;
}
void update1(int x, long long y, int k) {
  while (x < n + 1) {
    cot[k][x] += y;
    x += lowbit(x);
  }
}
int main() {
  int t;
  cin >> t;
  while (t--) {
    scanf("%d%d", &n, &m);
    for (int i = 0; i < 26; i++)
      for (int j = 0; j < n + 1; j++) cot[i][j] = 0;
    string s;
    cin >> s;
    vector<int> res(m);
    for (int i = 0; i < m; i++) {
      scanf("%d", &res[i]);
    }
    res.push_back(n);
    for (int i = 0; i < n; i++) {
      update1(i + 1, 1LL, (int)(s[i] - 'a'));
    }
    map<int, long long> ma;
    for (int j = 0; j <= m; j++) {
      ma[res[j]]++;
    }
    vector<long long> ans(26, 0);
    for (auto it = ma.begin(); it != ma.end(); it++) {
      for (int i = 0; i < 26; i++)
        ans[i] += (it->second) * (sum1((it->first), i));
    }
    for (int i = 0; i < 26; i++) {
      if (i != 0) printf(" ");
      printf("%lld", ans[i]);
    }
    printf("\n");
  }
  return 0;
}
