#include <bits/stdc++.h>
using namespace std;
inline bool valid(int x, int n) { return 0 <= x && x < n; }
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
template <typename T>
inline T pop(queue<T>& q) {
  T front = q.front();
  q.pop();
  return front;
}
template <typename T>
inline T gcd(T a, T b) {
  for (; b; a %= b, swap(a, b))
    ;
  return a;
}
template <typename T>
tuple<T, T, T> xgcd(T a, T b) {
  if (b == 0) return {1, 0, a};
  T x, y, g;
  tie(x, y, g) = xgcd(b, a % b);
  return {y, x - (a / b) * y, g};
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int t;
  cin >> t;
  while (t--) {
    int n, m;
    cin >> n >> m;
    string s;
    cin >> s;
    vector<int> p(m);
    for (int i = 0; i < m; i++) cin >> p[i];
    vector<vector<int> > press(n, vector<int>(26, 0));
    for (int i = 0; i < n; i++) {
      press[i][s[i] - 'a']++;
      if (i)
        for (int j = 0; j < 26; j++) {
          press[i][j] += press[i - 1][j];
        }
    }
    vector<int> rst(26, 0);
    for (int i = 0; i < m; i++) {
      for (int j = 0; j < 26; j++) {
        rst[j] += press[p[i] - 1][j];
      }
    }
    for (int j = 0; j < 26; j++) {
      rst[j] += press[n - 1][j];
    }
    for (int r : rst) cout << r << " ";
    cout << "\n";
  }
}
